fix equals, update without changes
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
<querydsl.version>5.1.0</querydsl.version>
|
<querydsl.version>5.1.0</querydsl.version>
|
||||||
<revision>0.4.0</revision>
|
<revision>0.4.3</revision>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PatchMapping;
|
import org.springframework.web.bind.annotation.PatchMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@@ -149,16 +148,14 @@ public class TurnoverController extends BaseController {
|
|||||||
throw new EntityResponseStatusException(errors.getAllErrors(), HttpStatus.CONFLICT);
|
throw new EntityResponseStatusException(errors.getAllErrors(), HttpStatus.CONFLICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasRole("ROLE_ADMIN")) {
|
|
||||||
Turnover existing = turnoverManager.get(turnover.getId());
|
Turnover existing = turnoverManager.get(turnover.getId());
|
||||||
|
if (!hasRole("ROLE_ADMIN")) {
|
||||||
if (!getCurrentUsername().equals(existing.getUsername())) {
|
if (!getCurrentUsername().equals(existing.getUsername())) {
|
||||||
throw new EntityResponseStatusException(HttpStatus.FORBIDDEN);
|
throw new EntityResponseStatusException(HttpStatus.FORBIDDEN);
|
||||||
}
|
}
|
||||||
turnover.setUsername(getCurrentUsername());
|
turnover.setUsername(getCurrentUsername());
|
||||||
}
|
}
|
||||||
|
|
||||||
Turnover existing = turnoverManager.get(turnover.getId());
|
|
||||||
|
|
||||||
if (existing.equals(turnover)) {
|
if (existing.equals(turnover)) {
|
||||||
throw new EntityResponseStatusException(HttpStatus.NOT_MODIFIED);
|
throw new EntityResponseStatusException(HttpStatus.NOT_MODIFIED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,24 +147,28 @@ public class Turnover {
|
|||||||
Turnover turnover = (Turnover) obj;
|
Turnover turnover = (Turnover) obj;
|
||||||
boolean equals = true;
|
boolean equals = true;
|
||||||
|
|
||||||
equals &= dueDate.equals(turnover.getDueDate());
|
equals &= dueDate == null && turnover.getDueDate() == null
|
||||||
|
|| dueDate != null && dueDate.equals(turnover.getDueDate());
|
||||||
|
|
||||||
equals &= id == null && turnover.getId() == null || id.equals(turnover.getId());
|
equals &= id == null && turnover.getId() == null || id != null && id.equals(turnover.getId());
|
||||||
|
|
||||||
equals &= username == null && turnover.getUsername() == null || username.equals(turnover.getUsername());
|
equals &= username == null && turnover.getUsername() == null
|
||||||
|
|| username != null && username.equals(turnover.getUsername());
|
||||||
|
|
||||||
equals &= customer == null && turnover.getCustomer() == null || customer.equals(turnover.getCustomer());
|
equals &= customer == null && turnover.getCustomer() == null
|
||||||
|
|| customer != null && customer.equals(turnover.getCustomer());
|
||||||
|
|
||||||
equals &= motif == null && turnover.getMotif() == null || motif.equals(turnover.getMotif());
|
equals &= motif == null && turnover.getMotif() == null || motif != null && motif.equals(turnover.getMotif());
|
||||||
|
|
||||||
equals &= price == turnover.getPrice();
|
equals &= price == turnover.getPrice();
|
||||||
|
|
||||||
equals &= timeInvestment == turnover.getTimeInvestment();
|
equals &= timeInvestment == turnover.getTimeInvestment();
|
||||||
|
|
||||||
equals &= remark == null && turnover.getRemark() == null || remark.equals(turnover.getRemark());
|
equals &= remark == null && turnover.getRemark() == null
|
||||||
|
|| remark != null && remark.equals(turnover.getRemark());
|
||||||
|
|
||||||
equals &= materialConsumption == null && turnover.getMaterialConsumption() == null
|
equals &= materialConsumption == null && turnover.getMaterialConsumption() == null
|
||||||
|| materialConsumption.equals(turnover.getMaterialConsumption());
|
|| materialConsumption != null && materialConsumption.equals(turnover.getMaterialConsumption());
|
||||||
|
|
||||||
return equals;
|
return equals;
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "buntspecht-web",
|
"name": "buntspecht-web",
|
||||||
"version": "0.4.2",
|
"version": "0.4.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "buntspecht-web",
|
"name": "buntspecht-web",
|
||||||
"version": "0.4.2",
|
"version": "0.4.3",
|
||||||
"license": "AGPL3",
|
"license": "AGPL3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^18.2.7",
|
"@angular/animations": "^18.2.7",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "buntspecht-web",
|
"name": "buntspecht-web",
|
||||||
"version": "0.4.2",
|
"version": "0.4.3",
|
||||||
"license": "AGPL3",
|
"license": "AGPL3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ export class PageTurnover implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.working = true;
|
this.working = true;
|
||||||
this.turnover.dueDate = this.form.get("dueDate").value;
|
this.turnover.dueDate = this.form.get("dueDate").value || this.turnover.created;
|
||||||
this.turnover.customer = this.form.get("customer").value;
|
this.turnover.customer = this.form.get("customer").value;
|
||||||
this.turnover.motif = this.form.get("motif").value;
|
this.turnover.motif = this.form.get("motif").value;
|
||||||
this.turnover.price = this.form.get("price").value;
|
this.turnover.price = this.form.get("price").value;
|
||||||
|
|||||||
Reference in New Issue
Block a user