浏览代码

update 支出录入接口修改

river 4 年之前
父节点
当前提交
95959c1968

+ 46 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/FinancialExpenditure.java

@@ -23,10 +23,10 @@ public class FinancialExpenditure {
 	@ApiModelProperty(value = "钉钉流程编号",required = false)
 	private String dingtalkProcessNo;
 	/**  */
-	@ApiModelProperty(value = "分部",required = false)
+	@ApiModelProperty(value = "分部id",required = false)
 	private Integer organId;
 	/**  */
-	@ApiModelProperty(value = "学校/合作单位",required = false)
+	@ApiModelProperty(value = "学校/合作单位id",required = false)
 	private Integer cooperationOrganId;
 	/**  */
 	@ApiModelProperty(value = "申请人",required = false)
@@ -49,6 +49,18 @@ public class FinancialExpenditure {
 	/**  */
 	@ApiModelProperty(value = "事由",required = false)
 	private String cause;
+
+	@ApiModelProperty(value = "分部",required = false)
+	private String organName;
+
+	@ApiModelProperty(value = "学校/合作单位",required = false)
+	private String cooperationOrganName;
+
+	@ApiModelProperty(value = "费用类型Str",required = false)
+	private String feeType;
+
+	@ApiModelProperty(value = "费用项目str",required = false)
+	private String feeProjectItem;
 	/**  */
 	private Date createTime;
 	/**  */
@@ -183,4 +195,36 @@ public class FinancialExpenditure {
 	public void setType(ExpenditureTypeEnum type) {
 		this.type = type;
 	}
+
+	public String getOrganName() {
+		return organName;
+	}
+
+	public void setOrganName(String organName) {
+		this.organName = organName;
+	}
+
+	public String getCooperationOrganName() {
+		return cooperationOrganName;
+	}
+
+	public void setCooperationOrganName(String cooperationOrganName) {
+		this.cooperationOrganName = cooperationOrganName;
+	}
+
+	public String getFeeType() {
+		return feeType;
+	}
+
+	public void setFeeType(String feeType) {
+		this.feeType = feeType;
+	}
+
+	public String getFeeProjectItem() {
+		return feeProjectItem;
+	}
+
+	public void setFeeProjectItem(String feeProjectItem) {
+		this.feeProjectItem = feeProjectItem;
+	}
 }

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -35,7 +35,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 				.hasIpAddress("0.0.0.0/0")
 				.antMatchers("/v2/api-docs", "/classGroup/highClassGroups", "/code/*", "/api/*", "/appVersionInfo/queryByPlatform", "/eduDegree/*",
 						"/uploadFile", "/eduContracts/queryProduceContract","/activity/doubleEleven2020Statis","/replacementInstrument/queryPage",
-						"/replacementInstrumentActivity/queryReplacementsStat","/eduStudentRegistration/queryPreApplyList","/eduSubject/findSubSubjects").permitAll().anyRequest().authenticated().and().httpBasic();
+						"/replacementInstrumentActivity/queryReplacementsStat","/eduStudentRegistration/queryPreApplyList","/eduSubject/findSubSubjects","/eduFinancialExpenditure/batchAdd").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 29 - 2
mec-web/src/main/java/com/ym/mec/web/controller/education/EduFinancialExpenditureController.java

@@ -1,8 +1,14 @@
 package com.ym.mec.web.controller.education;
 
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.CooperationOrganDao;
+import com.ym.mec.biz.dal.dao.OrganizationDao;
+import com.ym.mec.biz.dal.entity.CooperationOrgan;
 import com.ym.mec.biz.dal.entity.FinancialExpenditure;
+import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.entity.StudentVisit;
+import com.ym.mec.biz.dal.enums.ExpenditureTypeEnum;
+import com.ym.mec.biz.dal.enums.FeeProjectEnum;
 import com.ym.mec.biz.service.FinancialExpenditureService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -15,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Api(tags = "支出记录(教务端)")
 @RequestMapping("eduFinancialExpenditure")
@@ -22,10 +30,29 @@ import java.util.List;
 public class EduFinancialExpenditureController extends BaseController {
     @Autowired
     private FinancialExpenditureService financialExpenditureService;
+    @Autowired
+    private OrganizationDao organizationDao;
+    @Autowired
+    private CooperationOrganDao cooperationOrganDao;
 
     @ApiOperation(value = "批量添加支出记录")
     @PostMapping(value = "/batchAdd")
-    public HttpResponseResult<List<FinancialExpenditure>> batchAdd(@RequestBody List<FinancialExpenditure>financialExpenditures) {
-       return succeed(financialExpenditureService.batchAdd(financialExpenditures));
+    public HttpResponseResult<List<FinancialExpenditure>> batchAdd(@RequestBody List<FinancialExpenditure> financialExpenditures) {
+        List<Organization> organs = organizationDao.findAllOrgans();
+        Map<String, Integer> organMap = organs.stream().collect(Collectors.toMap(Organization::getName, Organization::getId));
+        List<CooperationOrgan> cooperationOrgans = cooperationOrganDao.getAllCooperationOrgan();
+        Map<String, Integer> cooperationOrganMap = cooperationOrgans.stream().collect(Collectors.toMap(e -> e.getName() + e.getOrganId(), e -> e.getId()));
+        for (FinancialExpenditure financialExpenditure : financialExpenditures) {
+            if (organMap.containsKey(financialExpenditure.getOrganName())) {
+                financialExpenditure.setOrganId(organMap.get(financialExpenditure.getOrganName()));
+            }
+            if (cooperationOrganMap.containsKey(financialExpenditure.getCooperationOrganName() + financialExpenditure.getOrganId())) {
+                Integer cooperationOrganId = cooperationOrganMap.get(financialExpenditure.getCooperationOrganName() + financialExpenditure.getOrganId());
+                financialExpenditure.setCooperationOrganId(cooperationOrganId);
+            }
+            financialExpenditure.setType(ExpenditureTypeEnum.valueOf(financialExpenditure.getFeeType()));
+            financialExpenditure.setFeeProject(FeeProjectEnum.valueOf(financialExpenditure.getFeeProjectItem()));
+        }
+        return succeed(financialExpenditureService.batchAdd(financialExpenditures));
     }
 }