|
|
@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.ZoneOffset;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -74,13 +75,13 @@ public class HlwOrderApiController extends JeecgController<HlwOrder, IHlwOrderSe
|
|
|
Integer subcontractorId = jsonObject.getInteger("subcontractorId");
|
|
|
String userCode = jsonObject.getString("userCode");
|
|
|
String workContract = jsonObject.getString("workContract");
|
|
|
- Date startDate=jsonObject.getDate("startDate");
|
|
|
- Date endDate=jsonObject.getDate("endDate");
|
|
|
+ Date startDate = jsonObject.getDate("startDate");
|
|
|
+ Date endDate = jsonObject.getDate("endDate");
|
|
|
String createBy = jsonObject.getString("createBy");
|
|
|
Integer contractId = jsonObject.getInteger("contractId");
|
|
|
HlwUser hlwUser = hlwUserService.getByUserCode(userCode);
|
|
|
- int countContract=hlwUserSubcontractorService.countContract(hlwUser.getId(),subcontractorId,startDate,endDate,contractId);
|
|
|
- if(countContract>0){
|
|
|
+ int countContract = hlwUserSubcontractorService.countContract(hlwUser.getId(), subcontractorId, startDate, endDate, contractId);
|
|
|
+ if (countContract > 0) {
|
|
|
return Result.error("新老合同时间无法重叠,请重新选择");
|
|
|
}
|
|
|
HlwUserSubcontractor hlwUserSubcontractor = hlwUserSubcontractorService.getById(contractId);
|
|
|
@@ -334,4 +335,44 @@ public class HlwOrderApiController extends JeecgController<HlwOrder, IHlwOrderSe
|
|
|
}
|
|
|
return Result.ok(subcontractorList);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 订单申请-服务商合同列表
|
|
|
+ *
|
|
|
+ * @param jsonObject
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "订单申请-服务商合同列表")
|
|
|
+ @ApiOperation(value = "订单申请-服务商合同列表", notes = "订单申请-服务商合同列表")
|
|
|
+ @PostMapping(value = "/subcontractorContractList")
|
|
|
+ public Result<?> queryOrderSubcontractorContractList(@RequestBody JSONObject jsonObject) {
|
|
|
+ Integer applicationId = jsonObject.getInteger("applicationId");
|
|
|
+ //获取请求参数
|
|
|
+ Integer pageNo = jsonObject.getInteger("pageNo");
|
|
|
+ Integer pageSize = jsonObject.getInteger("pageSize");
|
|
|
+ String orderCode = jsonObject.getString("orderCode");
|
|
|
+ Integer subcontractorId = jsonObject.getInteger("subcontractorId");
|
|
|
+ Page<HlwUserSubcontractor> page = new Page<HlwUserSubcontractor>(pageNo, pageSize);
|
|
|
+ Page<HlwUserSubcontractor> pageList = hlwUserSubcontractorService.queryOrderSubcontractorContractList(page, orderCode, subcontractorId);
|
|
|
+ //当天时间
|
|
|
+ LocalDate localDate = LocalDate.now();
|
|
|
+ for (HlwUserSubcontractor hlwUserSubcontractor : pageList.getRecords()) {
|
|
|
+ //判断合同是否过期或者即将过期
|
|
|
+ LocalDate startDate = DateUtils.asLocalDate(hlwUserSubcontractor.getStartDate());
|
|
|
+ LocalDate endDate = DateUtils.asLocalDate(hlwUserSubcontractor.getEndDate());
|
|
|
+ //30天
|
|
|
+ LocalDate localDateLast = localDate.plusDays(30);
|
|
|
+ //合同结束时间在当前时间之前
|
|
|
+ if (endDate.isBefore(localDate)) {
|
|
|
+ //已过期
|
|
|
+ hlwUserSubcontractor.setContractStatus(2);
|
|
|
+ } else if (localDate.isAfter(startDate) && (endDate.isBefore(localDateLast) || endDate.isEqual(localDateLast))) {
|
|
|
+ //当前时间大于合同开始时间 & 合同结束时间小于等于当前时间+30天
|
|
|
+ //即将过期
|
|
|
+ hlwUserSubcontractor.setContractStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Result.ok(pageList);
|
|
|
+
|
|
|
+ }
|
|
|
}
|