Browse Source

000000017

zhoulisky 6 months ago
parent
commit
683823e4d0

+ 30 - 2
kd-service/kd-scientific/src/main/java/org/sky/scientific/mapper/XmMapper.xml

@@ -81,7 +81,6 @@
     </select>
     </select>
 
 
     <select id="summaryPage" resultType="org.sky.scientific.pojo.vo.XmSummary">
     <select id="summaryPage" resultType="org.sky.scientific.pojo.vo.XmSummary">
-
         SELECT
         SELECT
         xm.id, xm.xmbh,xm.xmkssj,
         xm.id, xm.xmbh,xm.xmkssj,
         COALESCE(get_xm_info(xm.id, 'XMMC', #{ew.yearAndMonth}), xm.XMMC) AS xmmc,
         COALESCE(get_xm_info(xm.id, 'XMMC', #{ew.yearAndMonth}), xm.XMMC) AS xmmc,
@@ -111,9 +110,38 @@
         <if test="ew.xmfzrxm!=null and ew.xmfzrxm!=''">and tech.name like concat('%', #{ew.xmfzrxm},'%')</if>
         <if test="ew.xmfzrxm!=null and ew.xmfzrxm!=''">and tech.name like concat('%', #{ew.xmfzrxm},'%')</if>
         <if test="ew.xmsqdw!=null and ew.xmsqdw!=''">and CONCAT_WS('/',(SELECT name FROM kd_department d2 WHERE d2.id = d.parent_id), d.`name`) like concat('%',#{ew.xmsqdw},'%')</if>
         <if test="ew.xmsqdw!=null and ew.xmsqdw!=''">and CONCAT_WS('/',(SELECT name FROM kd_department d2 WHERE d2.id = d.parent_id), d.`name`) like concat('%',#{ew.xmsqdw},'%')</if>
         <if test="ew.status!=null">and COALESCE(get_xm_info(xm.id, 'STATUS', #{ew.yearAndMonth}), xm.STATUS) = #{ew.status}</if>
         <if test="ew.status!=null">and COALESCE(get_xm_info(xm.id, 'STATUS', #{ew.yearAndMonth}), xm.STATUS) = #{ew.status}</if>
-
     </select>
     </select>
 
 
+<!--    <select id="summaryPage" resultType="org.sky.scientific.pojo.vo.XmSummary">-->
+<!--        SELECT-->
+<!--        xm.id, xm.xmbh,xm.xmkssj,-->
+<!--        COALESCE(get_xm_info(xm.id, 'XMMC', #{ew.yearAndMonth}), xm.XMMC) AS xmmc,-->
+<!--        COALESCE(get_xm_info(xm.id, 'XMFZR', #{ew.yearAndMonth}), xm.XMFZR) AS xmfzr,-->
+<!--        tech.name as xmfzrxm,-->
+<!--        COALESCE(get_xm_info(xm.id, 'XMSQDWID', #{ew.yearAndMonth}), xm.XMSQDWID) AS xmsqdwid,-->
+<!--         COALESCE(get_xm_info(xm.id, 'XMJSSJ', #{ew.yearAndMonth}), xm.XMJSSJ) AS xmjssj,-->
+<!--        COALESCE(get_xm_info(xm.id, 'XMYSZEMX', #{ew.yearAndMonth}), xm.XMYSZEMX) AS xmyszemx,-->
+<!--        COALESCE(get_xm_info(xm.id, 'STATUS', #{ew.yearAndMonth}), xm.STATUS) AS status,-->
+<!--        LXBG as lxbg,-->
+<!--        (select count(*) from kd_xm_jdxbg jdxbg where jdxbg.xm_id = xm.id and date_format(jdxbg.fill_date,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as jdxbgCount,-->
+<!--        (select count(*) from kd_xm_jtb jtb where jtb.xm_id = xm.id and date_format(jtb.tbsj,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as ysbgCount,-->
+<!--        (select count(*) from kd_cg_zl zl where zl.xm_id = xm.id and zl.ZLLX = '发明专利' and date_format(zl.SHOUQUAN_RQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as fmzlCount,-->
+<!--        (select count(*) from kd_cg_zl zl where zl.xm_id = xm.id and zl.ZLLX = '实用新型专利' and date_format(zl.SHOUQUAN_RQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as syxxzlCount,-->
+<!--        (select count(*) from kd_cg_rjzzq rjzzq where rjzzq.xm_id = xm.id and date_format(rjzzq.DJPZRQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as rzCount,-->
+<!--        (select count(*) from kd_cg_jsbz jsbz where jsbz.xm_id = xm.id  and date_format(jsbz.SSRQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as bzCount,-->
+<!--        (select count(*) from kd_cg_kylw kylw where kylw.xm_id = xm.id  and date_format(kylw.FBRQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as lwCount,-->
+<!--        (select count(*) from kd_cg_qt qt where qt.xm_id = xm.id  and date_format(qt.SHOUQUAN_RQ,'%Y%m') between concat(left(#{ew.yearAndMonth},4),'01') and #{ew.yearAndMonth}) as qtCount,-->
+<!--        (select ifnull(sum(WWFYJE), 0) from kd_xm_wwxm ww where ww.XM_ID = xm.id and ww.year_and_month = left(#{ew.yearAndMonth}, 4)) as wwAmount-->
+<!--        FROM kd_xm xm-->
+<!--        LEFT JOIN kd_technician tech ON tech.id = COALESCE(get_xm_info(xm.id, 'XMFZR', #{ew.yearAndMonth}), xm.XMFZR)-->
+<!--        WHERE xm.tenant_id = #{ew.tenantId} and DATE_FORMAT(xm.XMKSSJ, '%Y%m') <![CDATA[<=]]> #{ew.yearAndMonth}-->
+<!--        <if test="ew.xmbh!=null and ew.xmbh!=''">and xm.XMBH like concat('%',#{ew.xmbh},'%')</if>-->
+<!--        <if test="ew.xmmc!=null and ew.xmmc!=''">and COALESCE(get_xm_info(xm.id, 'XMMC', #{ew.yearAndMonth}), xm.XMMC) like concat('%',#{ew.xmmc},'%')</if>-->
+<!--        <if test="ew.xmfzrxm!=null and ew.xmfzrxm!=''">and tech.name like concat('%', #{ew.xmfzrxm},'%')</if>-->
+<!--        <if test="ew.xmsqdw!=null and ew.xmsqdw!=''">and CONCAT_WS('/',(SELECT name FROM kd_department d2 WHERE d2.id = d.parent_id), d.`name`) like concat('%',#{ew.xmsqdw},'%')</if>-->
+<!--        <if test="ew.status!=null">and COALESCE(get_xm_info(xm.id, 'STATUS', #{ew.yearAndMonth}), xm.STATUS) = #{ew.status}</if>-->
+<!--    </select>-->
+
     <select id="selectYszb" resultType="org.sky.scientific.pojo.vo.XmYszbVO">
     <select id="selectYszb" resultType="org.sky.scientific.pojo.vo.XmYszbVO">
         SELECT xm.id as xmId,xm.XMKSSJ,
         SELECT xm.id as xmId,xm.XMKSSJ,
             COALESCE(get_xm_info(xm.id, 'XMMC', null), xm.XMMC) AS xmmc,
             COALESCE(get_xm_info(xm.id, 'XMMC', null), xm.XMMC) AS xmmc,

+ 19 - 7
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/EnterpriseInfoServiceImpl.java

@@ -92,23 +92,35 @@ public class EnterpriseInfoServiceImpl extends BaseServiceImpl<EnterpriseInfoMap
 		String lastYear = DateUtil.format(DateUtil.minusYears(DateUtil.parse(enterpriseInfo.getYearAndMonth(), DateUtil.PATTERN_YYYY), 1), DateUtil.PATTERN_YYYY);
 		String lastYear = DateUtil.format(DateUtil.minusYears(DateUtil.parse(enterpriseInfo.getYearAndMonth(), DateUtil.PATTERN_YYYY), 1), DateUtil.PATTERN_YYYY);
 		LambdaQueryWrapper<EnterpriseInfoEntity> eq = Wrappers.<EnterpriseInfoEntity>lambdaQuery()
 		LambdaQueryWrapper<EnterpriseInfoEntity> eq = Wrappers.<EnterpriseInfoEntity>lambdaQuery()
 			.eq(EnterpriseInfoEntity::getYearAndMonth, lastYear);
 			.eq(EnterpriseInfoEntity::getYearAndMonth, lastYear);
-		EnterpriseInfoEntity one = this.getOne(eq);
-		if (Func.isNull(one)) {
+		EnterpriseInfoEntity previousYearData = this.getOne(eq);
+		if (Func.isNull(previousYearData)) {
 			throw new ServiceException("上年度没有数据");
 			throw new ServiceException("上年度没有数据");
 		}
 		}
-		one.setYearAndMonth(enterpriseInfo.getYearAndMonth());
+
+		List<String> ignorePropList = Arrays.asList("id","yearAndMonth","currentYearIncome", "currentYearCost","previousYearIncome","previousYearCost","lastYearIncome","lastYearCost");
 
 
 		// 企业基础信息表
 		// 企业基础信息表
 		EnterpriseInfoEntity dbEntity = this.getOne(Wrappers.<EnterpriseInfoEntity>lambdaQuery()
 		EnterpriseInfoEntity dbEntity = this.getOne(Wrappers.<EnterpriseInfoEntity>lambdaQuery()
 			.eq(EnterpriseInfoEntity::getYearAndMonth, enterpriseInfo.getYearAndMonth()));
 			.eq(EnterpriseInfoEntity::getYearAndMonth, enterpriseInfo.getYearAndMonth()));
 		if (Func.isNull(dbEntity)) {
 		if (Func.isNull(dbEntity)) {
 			//新增
 			//新增
-			one.setId(null);
-			return this.save(one);
+			EnterpriseInfoEntity entity = BeanUtil.copyProperties(previousYearData, EnterpriseInfoEntity.class,  ignorePropList.toArray(new String[0]));
+			entity.setTenantId(SecureUtil.getTenantId());
+			entity.setYearAndMonth(enterpriseInfo.getYearAndMonth());
+			entity.setPreviousYearCost(previousYearData.getCurrentYearCost());
+			entity.setPreviousYearIncome(previousYearData.getCurrentYearIncome());
+			entity.setLastYearCost(previousYearData.getPreviousYearCost());
+			entity.setLastYearIncome(previousYearData.getPreviousYearIncome());
+
+			return this.save(entity);
 		} else {
 		} else {
 			//修改
 			//修改
-			one.setId(dbEntity.getId());
-			return this.updateById(one);
+			BeanUtil.copyProperties(previousYearData, dbEntity,  ignorePropList.toArray(new String[0]));
+			dbEntity.setPreviousYearCost(previousYearData.getCurrentYearCost());
+			dbEntity.setPreviousYearIncome(previousYearData.getCurrentYearIncome());
+			dbEntity.setLastYearCost(previousYearData.getPreviousYearCost());
+			dbEntity.setLastYearIncome(previousYearData.getPreviousYearIncome());
+			return this.updateById(dbEntity);
 		}
 		}
 	}
 	}
 
 

+ 4 - 4
kd-service/kd-scientific/src/main/java/org/sky/scientific/service/impl/XmBgrzServiceImpl.java

@@ -83,10 +83,10 @@ public class XmBgrzServiceImpl extends BaseServiceImpl<XmBgrzMapper, XmBgrzEntit
 				vo.setBghdz(technicianMapper.getNameById(Long.parseLong(vo.getBghdz())));
 				vo.setBghdz(technicianMapper.getNameById(Long.parseLong(vo.getBghdz())));
 				vo.setBghdzStr(vo.getBghdz());
 				vo.setBghdzStr(vo.getBghdz());
 			} else if ("STATUS".equalsIgnoreCase(vo.getZdmc())) {
 			} else if ("STATUS".equalsIgnoreCase(vo.getZdmc())) {
-				vo.setBgqdz(DictCache.getValue("project_state", vo.getBgqdz()));
-				vo.setBgqdzStr(vo.getBgqdz());
-				vo.setBghdz(DictCache.getValue("project_state", vo.getBghdz()));
-				vo.setBghdzStr(vo.getBghdz());
+				vo.setBgqdz(vo.getBgqdz());
+				vo.setBgqdzStr(DictCache.getValue("project_state", vo.getBgqdz()));
+				vo.setBghdz(vo.getBghdz());
+				vo.setBghdzStr(DictCache.getValue("project_state", vo.getBghdz()));
 			} else if ("XMYSZEMX".equalsIgnoreCase(vo.getZdmc())) {
 			} else if ("XMYSZEMX".equalsIgnoreCase(vo.getZdmc())) {
 				if (Func.isNotBlank(vo.getBgqdz())) {
 				if (Func.isNotBlank(vo.getBgqdz())) {
 					List<JSONObject> arr = JSON.parseArray(vo.getBgqdz(), JSONObject.class);
 					List<JSONObject> arr = JSON.parseArray(vo.getBgqdz(), JSONObject.class);

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

@@ -111,7 +111,7 @@ public class XmServiceImpl extends BaseServiceImpl<XmMapper, XmEntity> implement
 			}
 			}
 		}else {
 		}else {
 			List<String> validate = ValidationUtils.validate(xm);
 			List<String> validate = ValidationUtils.validate(xm);
-			if (Func.isEmpty(validate)) {
+			if (Func.isNotEmpty(validate)) {
 				throw new ServiceException(String.join(",", validate));
 				throw new ServiceException(String.join(",", validate));
 			}
 			}
 			this.judgeXmmcAvailable(xm.getXmmc());
 			this.judgeXmmcAvailable(xm.getXmmc());
@@ -207,6 +207,7 @@ public class XmServiceImpl extends BaseServiceImpl<XmMapper, XmEntity> implement
 		List<JSONObject> costAllList = xmCostDetailsMapper.statisticsCost(null, SecureUtil.getTenantId());
 		List<JSONObject> costAllList = xmCostDetailsMapper.statisticsCost(null, SecureUtil.getTenantId());
 
 
 		for (XmSummary xmVO : xmList) {
 		for (XmSummary xmVO : xmList) {
+			xmVO.setXmsqdw(departmentMapper.getFullNameById(xmVO.getXmsqdwid()));
 
 
 			//立项报告数量
 			//立项报告数量
 			xmVO.setLxbgCount(JSON.parseArray(xmVO.getLxbg()).size());
 			xmVO.setLxbgCount(JSON.parseArray(xmVO.getLxbg()).size());