zhoulisky месяцев назад: 9
Родитель
Сommit
34a68bebc5

+ 31 - 0
doc/New 2.txt

@@ -0,0 +1,31 @@
+set @yearAndMonth='2025';
+set @tenantId = '882990';
+
+SELECT
+        xm.*, tmp.xm_stage,tmp.gov_bonus,
+				IFNULL((SELECT COUNT(DISTINCT unicode) FROM kd_xm_technician xt where xt.xm_id = xm.xm_id GROUP BY xt.year_and_month ORDER BY xt.year_and_month desc  limit 1),0) as technicianCount
+FROM 
+(
+    SELECT
+        xm.id as xm_id,xm.tenant_id, 
+        COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMMC' AND DATE_FORMAT(bgrz.BGSXSJ,'%Y') <= @yearAndMonth ORDER BY bgrz.BGSXSJ DESC LIMIT 1),XMMC) AS XMMC,
+				xm.XMLY,xm.XMKZXS as kzxs,xm.YQCGXS as cgxs,xm.XMJSJJMB as jsjjmb,
+				xm.XMKSSJ as kssj,
+        COALESCE( (SELECT bgrz.BGHDZ FROM kd_xm_bgrz bgrz WHERE bgrz.XM_ID = xm.id AND bgrz.ZDMC = 'XMJSSJ' AND DATE_FORMAT(bgrz.BGSXSJ,'%Y') <=  @yearAndMonth ORDER BY bgrz.BGSXSJ DESC LIMIT 1),XMJSSJ) AS jssj
+    FROM kd_xm xm
+) xm
+LEFT JOIN kd_107_1 tmp on tmp.xm_id = xm.xm_id and tmp.year_and_month = @yearAndMonth
+WHERE xm.tenant_id = @tenantId and left(xm.jssj,4) >= @yearAndMonth 
+
+
+
+
+
+
+				
+				
+				
+				
+				
+
+        

+ 3 - 0
kd-service-api/kd-scientific-api/src/main/java/org/sky/scientific/pojo/vo/A107_1VO.java

@@ -13,6 +13,9 @@ import java.util.Date;
 @Schema(description = "107-1 企业研究开发项目情况")
 public class A107_1VO {
 
+	@Schema(description = "研发项目id")
+	private Long xmId;
+
 	@Schema(description = "研发项目名称")
 	private String xmmc;
 

+ 2 - 3
kd-service/kd-scientific/src/main/java/org/sky/scientific/controller/XmController.java

@@ -25,6 +25,7 @@ import org.sky.scientific.pojo.dto.XmDTO;
 import org.sky.scientific.pojo.dto.XmUpdateDto;
 import org.sky.scientific.pojo.entity.XmEntity;
 import org.sky.scientific.pojo.entity.XmFinanceEntity;
+import org.sky.scientific.pojo.vo.A107_1VO;
 import org.sky.scientific.pojo.vo.XmSummary;
 import org.sky.scientific.pojo.vo.XmVO;
 import org.sky.scientific.pojo.vo.XmYszbVO;
@@ -153,12 +154,10 @@ public class XmController extends KdController {
 		return R.status(xmFinanceService.physicalDeleteByIds(Func.toLongList(ids)));
 	}
 
-
-
 	@GetMapping("annual-situation/{year}")
 	@ApiOperationSupport(order = 30)
 	@Operation(summary = "107-1-企业研究开发项目情况")
-	public R selectAnnualSituation(@Parameter(description = "年度") @PathVariable String year) {
+	public R<List<A107_1VO>> selectAnnualSituation(@Parameter(description = "年度") @PathVariable String year) {
 		return R.data(service.selectAnnualSituation(year));
 	}
 

+ 2 - 1
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/IXmService.java

@@ -9,6 +9,7 @@ import org.sky.scientific.excel.XmExcel;
 import org.sky.scientific.pojo.dto.XmDTO;
 import org.sky.scientific.pojo.dto.XmUpdateDto;
 import org.sky.scientific.pojo.entity.XmEntity;
+import org.sky.scientific.pojo.vo.A107_1VO;
 import org.sky.scientific.pojo.vo.XmSummary;
 import org.sky.scientific.pojo.vo.XmVO;
 import org.sky.scientific.pojo.vo.XmYszbVO;
@@ -90,5 +91,5 @@ public interface IXmService extends BaseService<XmEntity> {
 	 * @param year
 	 * @return
 	 */
-	List<JSONObject> selectAnnualSituation(String year);
+	List<A107_1VO> selectAnnualSituation(String year);
 }

+ 10 - 5
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/TechnicianServiceImpl.java

@@ -72,18 +72,23 @@ public class TechnicianServiceImpl extends BaseServiceImpl<TechnicianMapper, Tec
 		}
 		technician.setUnicode(unicode);
 		//根据年月和工号或身份证
+//		LambdaQueryWrapper<TechnicianEntity> wrapper = Wrappers.<TechnicianEntity>lambdaQuery()
+//			.eq(TechnicianEntity::getYearAndMonth, technician.getYearAndMonth())
+//			.eq(TechnicianEntity::getNumber, technician.getNumber())
+//			.eq(TechnicianEntity::getIdCard, technician.getIdCard());
 		LambdaQueryWrapper<TechnicianEntity> wrapper = Wrappers.<TechnicianEntity>lambdaQuery()
 			.eq(TechnicianEntity::getYearAndMonth, technician.getYearAndMonth())
-			.eq(TechnicianEntity::getNumber, technician.getNumber())
-			.eq(TechnicianEntity::getIdCard, technician.getIdCard());
+			.eq(TechnicianEntity::getUnicode, technician.getUnicode());
 		TechnicianEntity dbTechnician = baseMapper.selectOne(wrapper);
 		if (dbTechnician == null) {
 			//新增
 			return this.save(technician);
-		} else {
-			technician.setId(dbTechnician.getId());
-			return this.updateById(technician);
 		}
+//		else {
+//			technician.setId(dbTechnician.getId());
+//			return this.updateById(technician);
+//		}
+		return true;
 	}
 
 	@Override

+ 2 - 1
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/XmServiceImpl.java

@@ -19,6 +19,7 @@ import org.sky.scientific.mapper.*;
 import org.sky.scientific.pojo.dto.XmDTO;
 import org.sky.scientific.pojo.dto.XmUpdateDto;
 import org.sky.scientific.pojo.entity.XmEntity;
+import org.sky.scientific.pojo.vo.A107_1VO;
 import org.sky.scientific.pojo.vo.XmSummary;
 import org.sky.scientific.pojo.vo.XmVO;
 import org.sky.scientific.pojo.vo.XmYszbVO;
@@ -171,7 +172,7 @@ public class XmServiceImpl extends BaseServiceImpl<XmMapper, XmEntity> implement
 	}
 
 	@Override
-	public List<JSONObject> selectAnnualSituation(String year) {
+	public List<A107_1VO> selectAnnualSituation(String year) {
 		return List.of();
 	}