|
|
@@ -44,12 +44,12 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
|
|
|
* @param t
|
|
|
* @param calculation 0 其他 1软著 2专利
|
|
|
* @param patentType 专利名称 0实用新型 1发明专利 2外观专利 3 其他
|
|
|
- * startType 0外包 1供应商 外包全为输入,供应商才分软著和专利从后台选取
|
|
|
+ * @param startType 0外包 1供应商 外包全为输入,供应商才分软著和专利从后台选取
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/addCompany" , method = RequestMethod.POST)
|
|
|
public Result addCompany(@Valid ThirdPartyCompany t,BindingResult bindingResult,
|
|
|
- Integer calculation,Integer patentType) {
|
|
|
+ Integer calculation) {
|
|
|
Result res =new Result();
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
@@ -60,16 +60,11 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"名称","名称"));
|
|
|
return res;
|
|
|
}
|
|
|
-// if(thirdPartyCompanyService.addCompanyChekeNumber(t)) {
|
|
|
-// res.getError().add(buildError("第三方数量总和必须小于项目数量。","第三方数量总和必须小于项目数量。"));
|
|
|
-// return res;
|
|
|
-// }
|
|
|
- //0 系统 1软著 2专利
|
|
|
if (calculation==1) {
|
|
|
thirdPartyCompanyService.calculationUnitPrice(t);
|
|
|
|
|
|
}else if (calculation==2) {
|
|
|
- thirdPartyCompanyService.calculationPatentUnitPrice(t,patentType);
|
|
|
+ thirdPartyCompanyService.calculationPatentUnitPrice(t);
|
|
|
}
|
|
|
if(calculation!=0&&(t.getUnitPrice()==null||t.getUnitPrice().compareTo(new BigDecimal(0))<1)) {
|
|
|
res.getError().add(buildError("后台无此项数据记录,请联系管理员","后台无此项数据记录,请联系管理员"));
|
|
|
@@ -82,7 +77,6 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
|
|
|
if (!res.getError().isEmpty()) {
|
|
|
return res;
|
|
|
}
|
|
|
- t.setPatentNameType(patentType);
|
|
|
res.data(thirdPartyCompanyService.addCompany(t,calculation));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -95,17 +89,13 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
|
|
|
*/
|
|
|
@RequestMapping(value = "/updateCompany" , method = RequestMethod.POST)
|
|
|
public Result updateCompany(@Valid ThirdPartyCompany t,BindingResult bindingResult,
|
|
|
- Integer calculation,Integer patentType) {
|
|
|
+ Integer calculation) {
|
|
|
Result res =new Result();
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
|
|
|
ThirdPartyError.getValueByCode(bindingResult.getFieldError().getField())));
|
|
|
return res;
|
|
|
}
|
|
|
-// if(thirdPartyCompanyService.addCompanyChekeNumber(t)) {
|
|
|
-// res.getError().add(buildError("第三方数量总和必须小于项目数量。","第三方数量总和必须小于项目数量。"));
|
|
|
-// return res;
|
|
|
-// }
|
|
|
if (null==t.getId()) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"编号","编号"));
|
|
|
return res;
|
|
|
@@ -118,12 +108,11 @@ public class ThirdPartyCompanyApiController extends BaseApiController{
|
|
|
if (calculation==1) {
|
|
|
thirdPartyCompanyService.calculationUnitPrice(t);
|
|
|
}else if (calculation==2) {
|
|
|
- thirdPartyCompanyService.calculationPatentUnitPrice(t,patentType);
|
|
|
+ thirdPartyCompanyService.calculationPatentUnitPrice(t);
|
|
|
}
|
|
|
if (!res.getError().isEmpty()) {
|
|
|
return res;
|
|
|
}
|
|
|
- t.setPatentNameType(patentType);
|
|
|
res.data(thirdPartyCompanyService.updateCompany(t,calculation));
|
|
|
return res;
|
|
|
}
|