|
@@ -7,11 +7,17 @@ import java.util.Calendar;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
+import com.rtrh.core.vo.Message;
|
|
|
|
+import com.rtrh.projects.modules.projects.service.WorkBenchService;
|
|
import com.rtrh.projects.modules.projects.vo.SubInfoQueryTzVO;
|
|
import com.rtrh.projects.modules.projects.vo.SubInfoQueryTzVO;
|
|
import com.rtrh.projects.modules.utils.DateUtils;
|
|
import com.rtrh.projects.modules.utils.DateUtils;
|
|
|
|
+import com.rtrh.projects.outapi.vo.SubMonthReportVO;
|
|
|
|
+import com.rtrh.projects.web.log.Log;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -68,6 +74,9 @@ public class MonthReportApiController extends BaseOutApiController {
|
|
@Autowired
|
|
@Autowired
|
|
private WeekAndMonthFileService weekAndMonthFileService;
|
|
private WeekAndMonthFileService weekAndMonthFileService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private WorkBenchService workBenchService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 月报列表
|
|
* 月报列表
|
|
*
|
|
*
|
|
@@ -81,7 +90,6 @@ public class MonthReportApiController extends BaseOutApiController {
|
|
*/
|
|
*/
|
|
@TokenAuthenticate
|
|
@TokenAuthenticate
|
|
@PostMapping("getList")
|
|
@PostMapping("getList")
|
|
- @ApiOperation("月报列表")
|
|
|
|
public JsonResult queryReport(@RequestBody Page page, @RequestBody ListQueryVO vo) {
|
|
public JsonResult queryReport(@RequestBody Page page, @RequestBody ListQueryVO vo) {
|
|
JsonResult result = new JsonResult();
|
|
JsonResult result = new JsonResult();
|
|
LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
@@ -107,7 +115,71 @@ public class MonthReportApiController extends BaseOutApiController {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @TokenAuthenticate
|
|
|
|
+ @PostMapping("getMonthList/app")
|
|
|
|
+ @ApiOperation("工信局APP月报列表")
|
|
|
|
+ public JsonResult gxjAppMonthReport(@RequestBody Page page, @RequestBody ListQueryVO vo) {
|
|
|
|
+ JsonResult result = new JsonResult();
|
|
|
|
+ LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
|
|
+ try {
|
|
|
|
+ List<SubMonthReportVO> convert = subRptContService.gxjAppMonthReport(page, vo, loginUserVO);
|
|
|
|
+ int year = DateUtil.year(vo.getStartMonth());
|
|
|
|
+ int month = DateUtil.month(vo.getStartMonth())+1;
|
|
|
|
+ List<RptCont> rptConts = workBenchService.monthReportGxj(String.valueOf(year),String.valueOf(month), "1");
|
|
|
|
+ Map<String, RptCont> rptMap = rptConts.stream().collect(Collectors.toMap(RptCont::getSubId, v -> v, (value, value2) -> value));
|
|
|
|
+ for(SubMonthReportVO reportVO : convert){
|
|
|
|
+ if(rptMap.containsKey(reportVO.getSubId())){
|
|
|
|
+ reportVO.setInputStatus("1");
|
|
|
|
+ }else {
|
|
|
|
+ reportVO.setInputStatus("0");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<SubMonthReportVO> resultList = new ArrayList<SubMonthReportVO>();
|
|
|
|
+ if(StringUtils.isNotBlank(vo.getStatus())){
|
|
|
|
+ if("1".equals(vo.getStatus())){
|
|
|
|
+ resultList.addAll(convert.stream().filter(f -> "1".equals(f.getInputStatus())).collect(Collectors.toList()));
|
|
|
|
+ }else if("0".equals(vo.getStatus())){
|
|
|
|
+ resultList.addAll(convert.stream().filter(f -> "0".equals(f.getInputStatus())).collect(Collectors.toList()));
|
|
|
|
+ }else {
|
|
|
|
+ resultList.addAll(convert);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ resultList.addAll(convert);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //手动分页
|
|
|
|
+ List<SubMonthReportVO> paginate = paginate(resultList, page.getPageNo(), page.getPageSize());
|
|
|
|
+ result.setData("list", paginate);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error("", e);
|
|
|
|
+ result.setCode(ResultCode.SYSTEM_ERROR, e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 对 List 集合进行分页截取
|
|
|
|
+ * @param list 原始 List 集合
|
|
|
|
+ * @param pageNum 页码,从 1 开始
|
|
|
|
+ * @param pageSize 每页显示的数据数量
|
|
|
|
+ * @param <T> 集合元素的类型
|
|
|
|
+ * @return 截取后的分页数据
|
|
|
|
+ */
|
|
|
|
+ public static <T> List<T> paginate(List<T> list, int pageNum, int pageSize) {
|
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ // 计算起始索引
|
|
|
|
+ int startIndex = (pageNum - 1) * pageSize;
|
|
|
|
+ // 如果起始索引超出集合大小,返回空列表
|
|
|
|
+ if (startIndex >= list.size()) {
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ // 计算结束索引
|
|
|
|
+ int endIndex = Math.min(startIndex + pageSize, list.size());
|
|
|
|
+ // 截取数据
|
|
|
|
+ return list.subList(startIndex, endIndex);
|
|
|
|
+ }
|
|
@PostMapping(value = "/list")
|
|
@PostMapping(value = "/list")
|
|
@TokenAuthenticate
|
|
@TokenAuthenticate
|
|
public JsonResult queryReportList(@RequestBody Page page, @RequestBody SubInfoQueryTzVO queryVO) {
|
|
public JsonResult queryReportList(@RequestBody Page page, @RequestBody SubInfoQueryTzVO queryVO) {
|
|
@@ -149,7 +221,6 @@ public class MonthReportApiController extends BaseOutApiController {
|
|
*/
|
|
*/
|
|
@TokenAuthenticate
|
|
@TokenAuthenticate
|
|
@PostMapping("queryReportMonth")
|
|
@PostMapping("queryReportMonth")
|
|
- @ApiOperation("查询指定项目的指定月份月报")
|
|
|
|
public JsonResult queryReportMonth(@RequestBody ReportMonthVO monthVO) {
|
|
public JsonResult queryReportMonth(@RequestBody ReportMonthVO monthVO) {
|
|
JsonResult result = new JsonResult();
|
|
JsonResult result = new JsonResult();
|
|
try {
|
|
try {
|
|
@@ -175,7 +246,6 @@ public class MonthReportApiController extends BaseOutApiController {
|
|
@TokenAuthenticate
|
|
@TokenAuthenticate
|
|
@PostMapping("save")
|
|
@PostMapping("save")
|
|
// @Log("月报保存")
|
|
// @Log("月报保存")
|
|
- @ApiOperation("月报录入")
|
|
|
|
public JsonResult saveReport(@RequestBody WeekContentVO vo) {
|
|
public JsonResult saveReport(@RequestBody WeekContentVO vo) {
|
|
JsonResult result = new JsonResult();
|
|
JsonResult result = new JsonResult();
|
|
LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
@@ -188,13 +258,46 @@ public class MonthReportApiController extends BaseOutApiController {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping(value="/saveReport/app")
|
|
|
|
+ @ApiOperation("工信局APP月报保存")
|
|
|
|
+ public Message saveReportApp(@RequestBody WeekContentVO vo) {
|
|
|
|
+ Message res = new Message();
|
|
|
|
+ try {
|
|
|
|
+ LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
|
|
+ subRptContService.saveFgwReport(vo, loginUserVO, RptContKindEnum.MONTH);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error("",e);
|
|
|
|
+ res.addError(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping(value="/del/app")
|
|
|
|
+ @ApiOperation("工信局APP月报删除")
|
|
|
|
+ public JsonResult deleteReportApp(@RequestBody DelReportVO delVO) {
|
|
|
|
+ JsonResult result = new JsonResult();
|
|
|
|
+ LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
|
|
+ try {
|
|
|
|
+ String week = String.valueOf(DateUtil.month(delVO.getBeginDate()) + 1);
|
|
|
|
+ RptCont old = subRptContService.getBySubIdAndMonth(delVO.getSubId(), delVO.getYear(), week, RptContKindEnum.MONTH);
|
|
|
|
+ if (old != null) {
|
|
|
|
+ subRptContService.appDel(old.getId(), loginUserVO.getLoginName());
|
|
|
|
+ } else {
|
|
|
|
+ throw new RuntimeException("未发现月报信息");
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error("", e);
|
|
|
|
+ result.setCode(ResultCode.SYSTEM_ERROR, e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 月报删除
|
|
* 月报删除
|
|
*/
|
|
*/
|
|
@TokenAuthenticate
|
|
@TokenAuthenticate
|
|
@PostMapping("del")
|
|
@PostMapping("del")
|
|
// @Log("月报删除")
|
|
// @Log("月报删除")
|
|
- @ApiOperation("月报删除")
|
|
|
|
public JsonResult del(@RequestBody DelReportVO delVO) {
|
|
public JsonResult del(@RequestBody DelReportVO delVO) {
|
|
JsonResult result = new JsonResult();
|
|
JsonResult result = new JsonResult();
|
|
LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
LoginUserVO loginUserVO = jwtUtils.getUserInfo(getToken());
|
|
@@ -214,12 +317,104 @@ public class MonthReportApiController extends BaseOutApiController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @TokenAuthenticate
|
|
|
|
+ @PostMapping("getById/app")
|
|
|
|
+ @ApiOperation("获取月报信息")
|
|
|
|
+ public JsonResult getByIdApp(@RequestBody ReportGetVO getVO) {
|
|
|
|
+ JsonResult result = new JsonResult();
|
|
|
|
+ LoginUserVO vo = jwtUtils.getUserInfo(getToken());
|
|
|
|
+ try {
|
|
|
|
+ //项目信息
|
|
|
|
+ String subId = getVO.getSubId();
|
|
|
|
+ SubInfo subInfo = subInfoService.getById(subId);
|
|
|
|
+ result.setData("subName", subInfo.getSubName());
|
|
|
|
+ result.setData("subId", subId);
|
|
|
|
+ Boolean checkEdit = vo.getEdit();
|
|
|
|
+ String currUserUnitId = vo.getUnitId();
|
|
|
|
+ if (currUserUnitId.equals(subInfo.getUnitId() == null ? "" : subInfo.getUnitId()) || checkEdit == true) {
|
|
|
|
+ result.setData("checkedit", "1");
|
|
|
|
+ } else {
|
|
|
|
+ result.setData("checkedit", "0");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ JUnit jUnit = jUnitService.getById(subInfo.getMainId());
|
|
|
|
+ if (jUnit != null) {
|
|
|
|
+ result.setData("UnitName", jUnit.getTitle());
|
|
|
|
+ } else {
|
|
|
|
+ result.setData("UnitName", "");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String week = String.valueOf(DateUtil.month(getVO.getStartDate()) + 1);
|
|
|
|
+ RptCont old = subRptContService.getBySubIdAndMonth(subId, getVO.getYear(), week, RptContKindEnum.MONTH);
|
|
|
|
+ if (old != null) {
|
|
|
|
+ result.setData("amt", old.getAmt());
|
|
|
|
+ result.setData("content", old.getContent());
|
|
|
|
+ result.setData("kjMonth", old.getKjMonth());
|
|
|
|
+ result.setData("numBl", old.getNumBl());
|
|
|
|
+ result.setData("amtLast", old.getAmtLast());
|
|
|
|
+ result.setData("reason", old.getReason());
|
|
|
|
+ result.setData("amtRt", old.getAmtRt());
|
|
|
|
+ } else {
|
|
|
|
+ result.setData("MonthInfo", "");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ String year_kj = getVO.getKjMonth().substring(0, 4);
|
|
|
|
+ String month = getVO.getKjMonth().substring(5, 7);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ int yearNum = Integer.parseInt(year_kj);
|
|
|
|
+ int monthnum = Integer.parseInt(month);
|
|
|
|
+
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ String dateString = simpleDateFormat.format(date);
|
|
|
|
+ int yearNum1 = Integer.parseInt(dateString.substring(0, 4));
|
|
|
|
+ int monthNum1 = Integer.parseInt(dateString.substring(5, 7));
|
|
|
|
+
|
|
|
|
+ if (yearNum1 == yearNum) {
|
|
|
|
+ //现在小于 计划
|
|
|
|
+ if (monthnum > monthNum1) {
|
|
|
|
+ result.setData("check", "0");
|
|
|
|
+ } else {
|
|
|
|
+ result.setData("check", "1");
|
|
|
|
+ }
|
|
|
|
+ } else if (yearNum > yearNum1) {
|
|
|
|
+ result.setData("check", "0");
|
|
|
|
+ } else {
|
|
|
|
+ result.setData("check", "1");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //获取附件信息
|
|
|
|
+ if (old != null) {
|
|
|
|
+ List<WeekAndMonthFile> listFile = weekAndMonthFileService.listByMainIdFgw(old.getId());
|
|
|
|
+ List<WeekAndMonthFileVO> listfileVo = new ArrayList<>();
|
|
|
|
+ for (WeekAndMonthFile e : listFile) {
|
|
|
|
+ WeekAndMonthFileVO weekAndMonthFileVO = new WeekAndMonthFileVO();
|
|
|
|
+ weekAndMonthFileVO.setId(e.getId());
|
|
|
|
+ weekAndMonthFileVO.setFileAddre(e.getFileAddre());
|
|
|
|
+ weekAndMonthFileVO.setFileType(e.getFileType());
|
|
|
|
+ weekAndMonthFileVO.setMainId(e.getMainId());
|
|
|
|
+ weekAndMonthFileVO.setFileName(e.getFileName());
|
|
|
|
+ weekAndMonthFileVO.setCreateTime(e.getCreateTime());
|
|
|
|
+ weekAndMonthFileVO.setUrl(ApiStaticUrl.getImg(e.getFileAddre()));
|
|
|
|
+ listfileVo.add(weekAndMonthFileVO);
|
|
|
|
+ }
|
|
|
|
+ result.setData("listFile", listfileVo);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ logger.error("", e);
|
|
|
|
+ result.setCode(ResultCode.SYSTEM_ERROR, e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取月报信息
|
|
* 获取月报信息
|
|
*/
|
|
*/
|
|
@TokenAuthenticate
|
|
@TokenAuthenticate
|
|
@PostMapping("getById")
|
|
@PostMapping("getById")
|
|
- @ApiOperation("获取月报信息")
|
|
|
|
public JsonResult getById(@RequestBody ReportGetVO getVO) {
|
|
public JsonResult getById(@RequestBody ReportGetVO getVO) {
|
|
JsonResult result = new JsonResult();
|
|
JsonResult result = new JsonResult();
|
|
LoginUserVO vo = jwtUtils.getUserInfo(getToken());
|
|
LoginUserVO vo = jwtUtils.getUserInfo(getToken());
|