修改年月传值

This commit is contained in:
lihao 2025-10-10 09:22:09 +08:00
parent 74e986bbf2
commit 8cf1d211db
1 changed files with 21 additions and 3 deletions

View File

@ -34,6 +34,10 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.*;
@Path("mmpac/applytask")
@ -68,14 +72,16 @@ public class ApplytaskRestResource extends AbstractNCCRestResource {
List<String> bids= new ArrayList<>();
List<AggTaskAVO> aggTaskAVOS = new ArrayList<>();
for (Map<String, Object> param : paramList) {
Object orderId= hybo.findColValue("mm_pmo","cpmohid"," vbillcode ='" + param.get("billcode") + "' ");
Object orderId= param.get("billcode") +"";
// Object orderId= hybo.findColValue("mm_pmo","cpmohid"," vbillcode ='" + param.get("billcode") + "' ");
// String mrlCode= (String) param.get("mrlcode");
// String mrlid=(String) hybo.findColValue("bd_material","pk_material"," code = '" + mrlCode + "' ");
// if(mrlid == null){
// throw new BusinessException("²úÆ·±àÂë²»ÄÜΪ¿Õ");
// }
if (orderId != null && !orderId.equals("")) {
PMOAggVO[] pmoaggvos = ((IPMOQueryService)NCLocator.getInstance().lookup(IPMOQueryService.class)).queryByPks(new String[]{(String) orderId});
PMOAggVO[] pmoaggvos = ((IPMOQueryService)NCLocator.getInstance().lookup(IPMOQueryService.class)).queryPMOAggVOByBid(new String[]{(String) orderId});
if (pmoaggvos == null || pmoaggvos.length == 0) {
}else{
@ -98,7 +104,7 @@ public class ApplytaskRestResource extends AbstractNCCRestResource {
taskABVO.setNactnum(new UFDouble((double) param.get("workTime")) );
String month = (String) param.get("month");
taskABVO.setDtaskdate(UFDate.getDate(month) );
taskABVO.setDtaskdate(UFDate.getDate(get25thOfMonth(month)) );
// taskABVO.setNactnum(new UFDouble((double) param.get("workTime")) );
}
@ -157,4 +163,16 @@ public class ApplytaskRestResource extends AbstractNCCRestResource {
return taskvos;
}
}
public static String get25thOfMonth(String yearMonthStr) throws DateTimeParseException {
// 定义解析年月字符串的格式yyyyMM
DateTimeFormatter parser = DateTimeFormatter.ofPattern("yyyyMM");
// 解析字符串为YearMonth对象包含年和月
YearMonth yearMonth = YearMonth.parse(yearMonthStr, parser);
// 获取该月的25号LocalDate对象
LocalDate date = yearMonth.atDay(25);
// 定义输出格式yyyy-MM-dd
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化并返回结果
return date.format(formatter);
}
}