提交 75e9104c 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 fd4b4c8d
...@@ -427,6 +427,71 @@ mock.onPost(new RegExp(/^\/contacts\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((c ...@@ -427,6 +427,71 @@ mock.onPost(new RegExp(/^\/contacts\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((c
return [status, data]; return [status, data];
}); });
// SetPrimary
mock.onPost(new RegExp(/^\/accounts\/([a-zA-Z0-9\-\;]{1,35})\/contacts\/([a-zA-Z0-9\-\;]{1,35})\/setprimary$/)).reply((config: any) => {
console.groupCollapsed("实体:contact 方法: SetPrimary");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['accountid','contactid'];
const matchArray:any = new RegExp(/^\/accounts\/([a-zA-Z0-9\-\;]{1,35})\/contacts\/([a-zA-Z0-9\-\;]{1,35})\/setprimary$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// SetPrimary
mock.onPost(new RegExp(/^\/contacts\/?([a-zA-Z0-9\-\;]{0,35})\/setprimary$/)).reply((config: any) => {
console.groupCollapsed("实体:contact 方法: SetPrimary");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['contactid'];
const matchArray:any = new RegExp(/^\/contacts\/([a-zA-Z0-9\-\;]{1,35})\/setprimary$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.contactid, tempValue.contactid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['contactid'] == tempValue['contactid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// FetchDefault // FetchDefault
mock.onGet(new RegExp(/^\/accounts\/([a-zA-Z0-9\-\;]{1,35})\/contacts\/fetchdefault$/)).reply((config: any) => { mock.onGet(new RegExp(/^\/accounts\/([a-zA-Z0-9\-\;]{1,35})\/contacts\/fetchdefault$/)).reply((config: any) => {
......
...@@ -485,7 +485,7 @@ export default class ContactUIServiceBase extends UIService { ...@@ -485,7 +485,7 @@ export default class ContactUIServiceBase extends UIService {
} }
const backend = () => { const backend = () => {
const curService:ContactService = new ContactService(); const curService:ContactService = new ContactService();
curService.Get(context,data, true).then((response: any) => { curService.SetPrimary(context,data, true).then((response: any) => {
if (!response || response.status !== 200) { if (!response || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: response.message }); actionContext.$Notice.error({ title: '错误', desc: response.message });
return; return;
......
...@@ -36,6 +36,7 @@ public interface IContactService extends IService<Contact>{ ...@@ -36,6 +36,7 @@ public interface IContactService extends IService<Contact>{
boolean checkKey(Contact et) ; boolean checkKey(Contact et) ;
boolean save(Contact et) ; boolean save(Contact et) ;
void saveBatch(List<Contact> list) ; void saveBatch(List<Contact> list) ;
Contact setPrimary(Contact et) ;
Page<Contact> searchDefault(ContactSearchContext context) ; Page<Contact> searchDefault(ContactSearchContext context) ;
List<Contact> selectByCustomerid(String accountid) ; List<Contact> selectByCustomerid(String accountid) ;
void removeByCustomerid(String accountid) ; void removeByCustomerid(String accountid) ;
......
...@@ -183,6 +183,13 @@ public class ContactServiceImpl extends ServiceImpl<ContactMapper, Contact> impl ...@@ -183,6 +183,13 @@ public class ContactServiceImpl extends ServiceImpl<ContactMapper, Contact> impl
saveOrUpdateBatch(list,batchSize); saveOrUpdateBatch(list,batchSize);
} }
@Override
@Transactional
public Contact setPrimary(Contact et) {
//自定义代码
return et;
}
@Override @Override
public List<Contact> selectByCustomerid(String accountid) { public List<Contact> selectByCustomerid(String accountid) {
......
package cn.ibizlab.businesscentral.core.extensions.service;
import cn.ibizlab.businesscentral.core.base.service.impl.ContactServiceImpl;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.businesscentral.core.base.domain.Contact;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;
/**
* 实体[联系人] 自定义服务对象
*/
@Slf4j
@Primary
@Service("ContactServiceEx")
public class ContactServiceEx extends ContactServiceImpl {
@Override
protected Class currentModelClass() {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
/**
* 自定义行为[SetPrimary]用户扩展
* @param et
* @return
*/
@Override
@Transactional
public Contact setPrimary(Contact et) {
return super.setPrimary(et);
}
}
...@@ -3206,7 +3206,7 @@ ...@@ -3206,7 +3206,7 @@
<!--输出实体[CONTACT]数据结构 --> <!--输出实体[CONTACT]数据结构 -->
<changeSet author="a_LAB01_e85d8801c" id="tab-contact-240-44"> <changeSet author="a_LAB01_e85d8801c" id="tab-contact-242-44">
<createTable tableName="CONTACT"> <createTable tableName="CONTACT">
<column name="ADDRESS1_FREIGHTTERMSCODE" remarks="" type="VARCHAR(30)"> <column name="ADDRESS1_FREIGHTTERMSCODE" remarks="" type="VARCHAR(30)">
</column> </column>
...@@ -11069,25 +11069,25 @@ ...@@ -11069,25 +11069,25 @@
<addForeignKeyConstraint baseColumnNames="ENTITLEMENTTEMPLATEID" baseTableName="ENTITLEMENTTEMPLATECHANNEL" constraintName="DER1N_ENTITLEMENTTEMPLATECHANN" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ENTITLEMENTTEMPLATEID" referencedTableName="ENTITLEMENTTEMPLATE" validate="true"/> <addForeignKeyConstraint baseColumnNames="ENTITLEMENTTEMPLATEID" baseTableName="ENTITLEMENTTEMPLATECHANNEL" constraintName="DER1N_ENTITLEMENTTEMPLATECHANN" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ENTITLEMENTTEMPLATEID" referencedTableName="ENTITLEMENTTEMPLATE" validate="true"/>
</changeSet> </changeSet>
<!--输出实体[CONTACT]外键关系 --> <!--输出实体[CONTACT]外键关系 -->
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-240-218"> <changeSet author="a_LAB01_e85d8801c" id="fk-contact-242-218">
<addForeignKeyConstraint baseColumnNames="CUSTOMERID" baseTableName="CONTACT" constraintName="DER1N_CONTACT_ACCOUNT_CUSTOMER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ACCOUNTID" referencedTableName="ACCOUNT" validate="true"/> <addForeignKeyConstraint baseColumnNames="CUSTOMERID" baseTableName="CONTACT" constraintName="DER1N_CONTACT_ACCOUNT_CUSTOMER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ACCOUNTID" referencedTableName="ACCOUNT" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-240-219"> <changeSet author="a_LAB01_e85d8801c" id="fk-contact-242-219">
<addForeignKeyConstraint baseColumnNames="PREFERREDEQUIPMENTID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__EQUIPMENT__PREF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="EQUIPMENTID" referencedTableName="EQUIPMENT" validate="true"/> <addForeignKeyConstraint baseColumnNames="PREFERREDEQUIPMENTID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__EQUIPMENT__PREF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="EQUIPMENTID" referencedTableName="EQUIPMENT" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-240-220"> <changeSet author="a_LAB01_e85d8801c" id="fk-contact-242-220">
<addForeignKeyConstraint baseColumnNames="ORIGINATINGLEADID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__LEAD__ORIGINATI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="LEADID" referencedTableName="LEAD" validate="true"/> <addForeignKeyConstraint baseColumnNames="ORIGINATINGLEADID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__LEAD__ORIGINATI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="LEADID" referencedTableName="LEAD" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-240-221"> <changeSet author="a_LAB01_e85d8801c" id="fk-contact-242-221">
<addForeignKeyConstraint baseColumnNames="DEFAULTPRICELEVELID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__PRICELEVEL__DEF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/> <addForeignKeyConstraint baseColumnNames="DEFAULTPRICELEVELID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__PRICELEVEL__DEF" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="PRICELEVELID" referencedTableName="PRICELEVEL" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-240-222"> <changeSet author="a_LAB01_e85d8801c" id="fk-contact-242-222">
<addForeignKeyConstraint baseColumnNames="PREFERREDSERVICEID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__SERVICE__PREFER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SERVICEID" referencedTableName="SERVICE" validate="true"/> <addForeignKeyConstraint baseColumnNames="PREFERREDSERVICEID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__SERVICE__PREFER" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SERVICEID" referencedTableName="SERVICE" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-240-223"> <changeSet author="a_LAB01_e85d8801c" id="fk-contact-242-223">
<addForeignKeyConstraint baseColumnNames="SLAID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__SLA__SLAID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SLAID" referencedTableName="SLA" validate="true"/> <addForeignKeyConstraint baseColumnNames="SLAID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__SLA__SLAID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="SLAID" referencedTableName="SLA" validate="true"/>
</changeSet> </changeSet>
<changeSet author="a_LAB01_e85d8801c" id="fk-contact-240-224"> <changeSet author="a_LAB01_e85d8801c" id="fk-contact-242-224">
<addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__TRANSACTIONCURR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/> <addForeignKeyConstraint baseColumnNames="TRANSACTIONCURRENCYID" baseTableName="CONTACT" constraintName="DER1N_CONTACT__TRANSACTIONCURR" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TRANSACTIONCURRENCYID" referencedTableName="TRANSACTIONCURRENCY" validate="true"/>
</changeSet> </changeSet>
<!--输出实体[TEAM]外键关系 --> <!--输出实体[TEAM]外键关系 -->
......
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
"delogicname":"联系人", "delogicname":"联系人",
"sysmoudle":{"id":"BASE","name":"Base"}, "sysmoudle":{"id":"BASE","name":"Base"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}], "dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }], "deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"SetPrimary" , "name":"SetPrimary" , "type":"USERCUSTOM" }],
"datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}] "datascope":[{"id":"all","name":"全部数据"}, {"id":"createman","name":"创建人"}]
} }
, { , {
......
...@@ -139,6 +139,18 @@ public class ContactResource { ...@@ -139,6 +139,18 @@ public class ContactResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Contact-SetPrimary-all')")
@ApiOperation(value = "", tags = {"联系人" }, notes = "")
@RequestMapping(method = RequestMethod.POST, value = "/contacts/{contact_id}/setprimary")
@Transactional
public ResponseEntity<ContactDTO> setPrimary(@PathVariable("contact_id") String contact_id, @RequestBody ContactDTO contactdto) {
Contact domain = contactMapping.toDomain(contactdto);
domain.setContactid(contact_id);
domain = contactService.setPrimary(domain);
contactdto = contactMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(contactdto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Contact-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Contact-Get')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Contact-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Contact-Get')")
@ApiOperation(value = "获取DEFAULT", tags = {"联系人" } ,notes = "获取DEFAULT") @ApiOperation(value = "获取DEFAULT", tags = {"联系人" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/contacts/fetchdefault") @RequestMapping(method= RequestMethod.GET , value="/contacts/fetchdefault")
...@@ -270,6 +282,18 @@ public class ContactResource { ...@@ -270,6 +282,18 @@ public class ContactResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Contact-SetPrimary-all')")
@ApiOperation(value = "根据客户联系人", tags = {"联系人" }, notes = "根据客户联系人")
@RequestMapping(method = RequestMethod.POST, value = "/accounts/{account_id}/contacts/{contact_id}/setprimary")
@Transactional
public ResponseEntity<ContactDTO> setPrimaryByAccount(@PathVariable("account_id") String account_id, @PathVariable("contact_id") String contact_id, @RequestBody ContactDTO contactdto) {
Contact domain = contactMapping.toDomain(contactdto);
domain.setCustomerid(account_id);
domain = contactService.setPrimary(domain) ;
contactdto = contactMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(contactdto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Contact-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Contact-Get')") @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizBusinessCentral-Contact-searchDefault-all') and hasPermission(#context,'iBizBusinessCentral-Contact-Get')")
@ApiOperation(value = "根据客户获取DEFAULT", tags = {"联系人" } ,notes = "根据客户获取DEFAULT") @ApiOperation(value = "根据客户获取DEFAULT", tags = {"联系人" } ,notes = "根据客户获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/accounts/{account_id}/contacts/fetchdefault") @RequestMapping(method= RequestMethod.GET , value="/accounts/{account_id}/contacts/fetchdefault")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册