|
@@ -84,58 +84,6 @@ public class CmcBrandProjectController extends BaseController
|
84
|
84
|
@PostMapping
|
85
|
85
|
public AjaxResult add(@RequestBody CmcBrandProject cmcBrandProject)
|
86
|
86
|
{
|
87
|
|
- if (cmcBrandProject.getPartnerId().split(",").length == 0) {
|
88
|
|
- if (!cmcBrandProject.getPartnerId().matches("-?\\d+(\\.\\d+)?")) {
|
89
|
|
- CmcPartner cmcPartner = new CmcPartner();
|
90
|
|
- cmcPartner.setPartnerId(String.valueOf(cmcPartnerService.selectCmcPartnerList(new CmcPartner()).size() + 1));
|
91
|
|
- cmcPartner.setPartnerName(cmcBrandProject.getPartnerId());
|
92
|
|
- cmcPartner.setTelephone(cmcBrandProject.getTelephone());
|
93
|
|
- cmcPartner.setContactPerson(cmcBrandProject.getContactPerson());
|
94
|
|
- cmcPartnerService.insertCmcPartner(cmcPartner);
|
95
|
|
- cmcBrandProject.setPartnerId(cmcPartner.getPartnerId());
|
96
|
|
- }
|
97
|
|
- }
|
98
|
|
- if (cmcBrandProject.getPartnerId().split(",").length > 0) {
|
99
|
|
- StringBuilder partnerIds = new StringBuilder();
|
100
|
|
- for (int i = 0; i < cmcBrandProject.getPartnerId().split(",").length; i++) {
|
101
|
|
- if (!cmcBrandProject.getPartnerId().split(",")[i].matches("-?\\d+(\\.\\d+)?")) {
|
102
|
|
- CmcPartner cmcPartner = new CmcPartner();
|
103
|
|
- cmcPartner.setPartnerId(String.valueOf(cmcPartnerService.selectCmcPartnerList(new CmcPartner()).size() + 1));
|
104
|
|
- cmcPartner.setPartnerName(cmcBrandProject.getPartnerId().split(",")[i]);
|
105
|
|
- cmcPartner.setTelephone(cmcBrandProject.getTelephone().split(",")[i]);
|
106
|
|
- cmcPartner.setContactPerson(cmcBrandProject.getContactPerson().split(",")[i]);
|
107
|
|
- cmcPartnerService.insertCmcPartner(cmcPartner);
|
108
|
|
- partnerIds.append(cmcPartner.getPartnerId()).append(",");
|
109
|
|
- }
|
110
|
|
- else
|
111
|
|
- partnerIds.append(cmcBrandProject.getPartnerId().split(",")[i]).append(",");
|
112
|
|
- }
|
113
|
|
- cmcBrandProject.setPartnerId(partnerIds.substring(0, partnerIds.length() - 1));
|
114
|
|
- }
|
115
|
|
- if (cmcBrandProject.getPartyAId().split(",").length == 0) {
|
116
|
|
- if (!cmcBrandProject.getPartyAId().matches("-?\\d+(\\.\\d+)?")) {
|
117
|
|
- CmcPartyA cmcPartyA = new CmcPartyA();
|
118
|
|
- cmcPartyA.setPartyAId(String.valueOf(cmcPartyAService.selectCmcPartyAList(new CmcPartyA()).size() + 1));
|
119
|
|
- cmcPartyA.setPartyAName(cmcBrandProject.getPartyAId());
|
120
|
|
- cmcPartyAService.insertCmcPartyA(cmcPartyA);
|
121
|
|
- cmcBrandProject.setPartyAId(cmcPartyA.getPartyAId());
|
122
|
|
- }
|
123
|
|
- }
|
124
|
|
- if (cmcBrandProject.getPartyAId().split(",").length > 0) {
|
125
|
|
- StringBuilder partyAIds = new StringBuilder();
|
126
|
|
- for (int i = 0; i < cmcBrandProject.getPartyAId().split(",").length; i++) {
|
127
|
|
- if (!cmcBrandProject.getPartyAId().split(",")[i].matches("-?\\d+(\\.\\d+)?")) {
|
128
|
|
- CmcPartyA cmcPartyA = new CmcPartyA();
|
129
|
|
- cmcPartyA.setPartyAId(String.valueOf(cmcPartyAService.selectCmcPartyAList(new CmcPartyA()).size() + 1));
|
130
|
|
- cmcPartyA.setPartyAName(cmcBrandProject.getPartyAId().split(",")[i]);
|
131
|
|
- cmcPartyAService.insertCmcPartyA(cmcPartyA);
|
132
|
|
- partyAIds.append(cmcPartyA.getPartyAId()).append(",");
|
133
|
|
- }
|
134
|
|
- else
|
135
|
|
- partyAIds.append(cmcBrandProject.getPartyAId().split(",")[i]).append(",");
|
136
|
|
- }
|
137
|
|
- cmcBrandProject.setPartyAId(partyAIds.substring(0, partyAIds.length() - 1));
|
138
|
|
- }
|
139
|
87
|
cmcBrandProject.setProjectId(new SnowFlake().generateId());
|
140
|
88
|
return toAjax(cmcBrandProjectService.insertCmcBrandProject(cmcBrandProject));
|
141
|
89
|
}
|