|
@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
+import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.utils.StringUtils;
|
|
|
+import com.jeeplus.sys.utils.UserUtils;
|
|
|
import com.jeeplus.test.cw.workClientInfo.domain.CwWorkClientBase;
|
|
|
import com.jeeplus.test.cw.workClientInfo.domain.CwWorkClientBilling;
|
|
|
import com.jeeplus.test.cw.workClientInfo.domain.CwWorkClientContact;
|
|
@@ -21,7 +23,9 @@ import com.jeeplus.test.cw.workClientInfo.service.mapstruct.CwWorkClientBaseWrap
|
|
|
import com.jeeplus.test.cw.workClientInfo.service.mapstruct.CwWorkClientBillingWrapper;
|
|
|
import com.jeeplus.test.cw.workClientInfo.service.mapstruct.CwWorkClientContactWrapper;
|
|
|
import com.jeeplus.test.cw.workClientInfo.service.mapstruct.CwWorkClientTypeWrapper;
|
|
|
+import com.jeeplus.test.mould.service.SerialnumTplService;
|
|
|
import com.jeeplus.test.oss.service.OssService;
|
|
|
+import com.jeeplus.test.program.configuration.projectList.service.dto.ProjectListDto;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -47,6 +51,8 @@ public class CwWorkClientService extends ServiceImpl<CwWorkClientBaseMapper, CwW
|
|
|
@Resource
|
|
|
private CwOrganizationTypeService cwOrganizationTypeService;
|
|
|
@Resource
|
|
|
+ private SerialnumTplService serialnumTplService;
|
|
|
+ @Resource
|
|
|
private OssService ossService;
|
|
|
|
|
|
public IPage<CwWorkClientBaseDTO> findList(Page<CwWorkClientBaseDTO> page, CwWorkClientBaseDTO cwWorkClientBaseDTO) throws Exception{
|
|
@@ -66,6 +72,13 @@ public class CwWorkClientService extends ServiceImpl<CwWorkClientBaseMapper, CwW
|
|
|
|
|
|
public String saveForm(CwWorkClientBaseDTO cwWorkClientBaseDTO) throws Exception{
|
|
|
CwWorkClientBase cwWorkClientBase = CwWorkClientBaseWrapper.INSTANCE.toEntity(cwWorkClientBaseDTO);
|
|
|
+ if(ObjectUtil.isNotEmpty(cwWorkClientBase)){
|
|
|
+ if(StringUtils.isBlank(cwWorkClientBase.getId())){
|
|
|
+ UserDTO userDTO = UserUtils.getCurrentUserDTO();
|
|
|
+ String no = serialnumTplService.genSerialNum(userDTO.getCompanyDTO().getId(), CwWorkClientBaseDTO.BIZ_CODE);
|
|
|
+ cwWorkClientBase.setNo(no);
|
|
|
+ }
|
|
|
+ }
|
|
|
this.saveOrUpdate(cwWorkClientBase);
|
|
|
if (ObjectUtil.isNotEmpty(cwWorkClientBaseDTO)) {
|
|
|
// 附件
|
|
@@ -73,6 +86,7 @@ public class CwWorkClientService extends ServiceImpl<CwWorkClientBaseMapper, CwW
|
|
|
// 客户类型
|
|
|
if (ObjectUtil.isNotEmpty(cwWorkClientBaseDTO.getCwWorkClientTypeDTO())){
|
|
|
CwWorkClientType cwWorkClientType = CwWorkClientTypeWrapper.INSTANCE.toEntity(cwWorkClientBaseDTO.getCwWorkClientTypeDTO());
|
|
|
+ cwWorkClientType.setClientId(cwWorkClientBase.getId());
|
|
|
cwWorkClientTypeService.saveOrUpdate(cwWorkClientType);
|
|
|
}
|
|
|
// 开票信息
|
|
@@ -91,6 +105,9 @@ public class CwWorkClientService extends ServiceImpl<CwWorkClientBaseMapper, CwW
|
|
|
}
|
|
|
cwWorkClientBaseDTO.getCwWorkClientBillingDTOList().stream().forEach(item->{
|
|
|
CwWorkClientBilling cwWorkClientBilling = CwWorkClientBillingWrapper.INSTANCE.toEntity(item);
|
|
|
+ if (StringUtils.isEmpty(item.getId())) {
|
|
|
+ cwWorkClientBilling.setClientId(cwWorkClientBase.getId());
|
|
|
+ }
|
|
|
cwWorkClientBillingService.saveOrUpdate(cwWorkClientBilling);
|
|
|
});
|
|
|
} else {
|
|
@@ -112,6 +129,9 @@ public class CwWorkClientService extends ServiceImpl<CwWorkClientBaseMapper, CwW
|
|
|
}
|
|
|
cwWorkClientBaseDTO.getCwWorkClientContactDTOList().stream().forEach(item->{
|
|
|
CwWorkClientContact cwWorkClientContact = CwWorkClientContactWrapper.INSTANCE.toEntity(item);
|
|
|
+ if (StringUtils.isEmpty(item.getId())) {
|
|
|
+ cwWorkClientContact.setClientId(cwWorkClientBase.getId());
|
|
|
+ }
|
|
|
cwWorkClientContactService.saveOrUpdate(cwWorkClientContact);
|
|
|
});
|
|
|
} else {
|