| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194 |
- package com.goafanti.admin.controller;
- import java.io.IOException;
- import java.text.ParseException;
- import java.util.ArrayList;
- import java.util.Calendar;
- import java.util.List;
- import java.util.UUID;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.multipart.MultipartFile;
- import com.goafanti.admin.service.AftFileService;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.constant.ErrorConstants;
- import com.goafanti.common.controller.BaseApiController;
- import com.goafanti.common.model.AftFile;
- import com.goafanti.common.model.OrgActivity;
- import com.goafanti.common.model.OrgActivityCost;
- import com.goafanti.common.model.OrgAnnualReport;
- import com.goafanti.common.model.OrgCognizance;
- import com.goafanti.common.model.OrgCognizanceLog;
- import com.goafanti.common.model.OrgFinance;
- import com.goafanti.common.model.OrgHonorDatum;
- import com.goafanti.common.model.OrgHumanResource;
- import com.goafanti.common.model.OrgIntellectualProperty;
- import com.goafanti.common.model.OrgRatepay;
- import com.goafanti.common.model.OrgStandard;
- import com.goafanti.common.model.OrgTechAchievement;
- import com.goafanti.common.model.OrgTechCenter;
- import com.goafanti.common.model.OrgTechProduct;
- import com.goafanti.common.model.OrganizationIdentity;
- import com.goafanti.common.model.User;
- import com.goafanti.common.model.UserAbility;
- import com.goafanti.common.model.UserIdentity;
- import com.goafanti.common.utils.DateUtils;
- import com.goafanti.common.utils.LoggerUtils;
- import com.goafanti.common.utils.PasswordUtil;
- import com.goafanti.common.utils.StringUtils;
- import com.goafanti.core.mybatis.page.Pagination;
- import com.goafanti.core.shiro.token.TokenManager;
- import com.goafanti.techservice.cognizance.bo.ActivityNumberBo;
- import com.goafanti.techservice.cognizance.bo.AnnualReportBo;
- import com.goafanti.techservice.cognizance.bo.CognizanceDetailBo;
- import com.goafanti.techservice.cognizance.service.OrgActivityCostService;
- import com.goafanti.techservice.cognizance.service.OrgActivityService;
- import com.goafanti.techservice.cognizance.service.OrgAnnualReportService;
- import com.goafanti.techservice.cognizance.service.OrgCognizanceLogService;
- import com.goafanti.techservice.cognizance.service.OrgCognizanceService;
- import com.goafanti.techservice.cognizance.service.OrgFinanceService;
- import com.goafanti.techservice.cognizance.service.OrgHonorDatumService;
- import com.goafanti.techservice.cognizance.service.OrgIntellectualPropertyService;
- import com.goafanti.techservice.cognizance.service.OrgRatepayService;
- import com.goafanti.techservice.cognizance.service.OrgStandardService;
- import com.goafanti.techservice.cognizance.service.OrgTechAchievementService;
- import com.goafanti.techservice.cognizance.service.OrgTechCenterService;
- import com.goafanti.techservice.cognizance.service.OrgTechProductService;
- import com.goafanti.techservice.patent.service.AdminService;
- import com.goafanti.user.bo.OrgListBo;
- import com.goafanti.user.bo.UserListBo;
- import com.goafanti.user.service.OrgHumanResourceService;
- import com.goafanti.user.service.OrganizationIdentityService;
- import com.goafanti.user.service.UserAbilityService;
- import com.goafanti.user.service.UserIdentityService;
- import com.goafanti.user.service.UserService;
- @Controller
- @RequestMapping(value = "/api/admin")
- public class AdminApiController extends BaseApiController {
- @Resource
- private UserService userService;
- @Resource
- private UserIdentityService userIdentityService;
- @Resource
- private OrganizationIdentityService organizationIdentityService;
- @Resource
- private OrgHumanResourceService orgHumanResourceService;
- @Resource
- private OrgStandardService orgStandardService;
- @Resource
- private OrgIntellectualPropertyService orgIntellectualPropertyService;
- @Resource
- private OrgTechProductService orgTechProductService;
- @Resource
- private OrgRatepayService orgRatepayService;
- @Resource
- private OrgFinanceService orgFinanceService;
- @Resource
- private OrgActivityService orgActivityService;
- @Resource
- private OrgActivityCostService orgActivityCostService;
- @Resource
- private OrgTechAchievementService orgTechAchievementService;
- @Resource
- private OrgHonorDatumService orgHonorDatumService;
- @Resource
- private OrgTechCenterService orgTechCenterService;
- @Resource
- private OrgCognizanceService orgCognizanceService;
- @Resource
- private OrgCognizanceLogService orgCognizanceLogService;
- @Resource
- private UserAbilityService userAbilityService;
- @Resource
- private OrgAnnualReportService orgAnnualReportService;
- @Resource
- private AftFileService aftFileService;
- @Resource(name = "passwordUtil")
- private PasswordUtil passwordUtil;
- @Resource
- private AdminService adminService;
- /**
- * 新增用户
- *
- * @param mobile
- * @param type
- * @param unitName
- * @return
- */
- @RequestMapping(value = "/addNewUser", method = RequestMethod.POST)
- public Result addNewUser(String mobile, Integer type, String unitName) {
- Result res = new Result();
- User user = userService.selectByMobieAndType(mobile, type);
- if (null != user) {
- res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
- return res;
- }
- User u = new User();
- u.setId(UUID.randomUUID().toString());
- u.setMobile(mobile);
- u.setPassword(mobile);
- u.setType(type);
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- u.setCreateTime(now.getTime());
- u.setPassword(passwordUtil.getEncryptPwd(u));
- u.setLvl(0);
- u.setAid(TokenManager.getAdminId());
- userService.insertRegister(u, "", unitName);
- return res;
- }
- /**
- * 个人用户列表
- *
- * @param mobile
- * @param email
- * @param createTime
- * @param number
- * @param auditStatus
- * @param pageNo
- * @param pageSize
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/userList", method = RequestMethod.POST)
- public Result userList(String mobile, String email,
- @RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number,
- String aftUsername, Integer auditStatus, String pageNo, String pageSize) throws ParseException {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getUserList(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize));
- return res;
- }
- /**
- * 个人用户信息明细
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/userDetail", method = RequestMethod.POST)
- public Result userDetail(String uid) {
- Result res = new Result();
- res.setData(userIdentityService.selectUserIdentityByUserId(uid));
- return res;
- }
- /**
- * 修改个人用户信息
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "updateUserDetail", method = RequestMethod.POST)
- public Result updateUserDetail(UserIdentity userIdentity, String paymentDateFormattedDate) throws ParseException {
- Result res = new Result();
- if (!StringUtils.isBlank(paymentDateFormattedDate)) {
- userIdentity.setPaymentDate(DateUtils.parseDate(paymentDateFormattedDate, "yyyy-MM-dd"));
- }
- res.setData(userIdentityService.updateByPrimaryKeySelective(userIdentity));
- return res;
- }
- /**
- * 团体用户列表
- *
- * @param mobile
- * @param email
- * @param createTime
- * @param number
- * @param auditStatus
- * @param pageNo
- * @param pageSize
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/orgList", method = RequestMethod.POST)
- public Result orgList(String mobile, String email,
- @RequestParam(name = "createTime[]", required = false) String[] createTime, Integer number,
- String aftUsername, Integer auditStatus, String pageNo, String pageSize) throws ParseException {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(getOrgList(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize));
- return res;
- }
- /**
- * 团体用户明细
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/orgDetail", method = RequestMethod.POST)
- public Result orgDetail(String uid) {
- Result res = new Result();
- res.setData(organizationIdentityService.selectOrgIdentityByUserId(uid));
- return res;
- }
- /**
- * 修改团体用户信息
- *
- * @param orgIdentity
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/updateOrgDetail", method = RequestMethod.POST)
- public Result updateOrgDetail(OrganizationIdentity orgIdentity, String paymentDateFormattedDate)
- throws ParseException {
- Result res = new Result();
- if (!StringUtils.isBlank(paymentDateFormattedDate)) {
- orgIdentity.setPaymentDate(DateUtils.parseDate(paymentDateFormattedDate, "yyyy-MM-dd"));
- }
- res.setData(organizationIdentityService.updateByPrimaryKeySelective(orgIdentity));
- return res;
- }
- /**
- * 团体用户人力资源情况入口
- *
- * @param uid
- * 用户ID
- * @return
- */
- @RequestMapping(value = "/orgHumanResource", method = RequestMethod.POST)
- public Result orgHumanResource(Integer year, String pageNo, String pageSize, String uid) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgHumanResourceService.listOrgHumanResource(year, pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 修改团体用户人力资源情况
- *
- * @param orgHumanResource
- * @return
- */
- @RequestMapping(value = "/updateOrgHumanResource", method = RequestMethod.POST)
- public Result updateOrgHumanResource(OrgHumanResource orgHumanResource) {
- Result res = new Result();
- if (null == orgHumanResource.getId()) {
- if (null != orgHumanResourceService.selectOrgHumanResourceByUidAndYear(orgHumanResource.getYear(),
- orgHumanResource.getUid())){
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度人力资源情况已录入!"));
- return res;
- }
- orgHumanResource.setId(UUID.randomUUID().toString());
- orgHumanResource.setDeletedSign(0);
- orgHumanResourceService.insert(orgHumanResource);
- } else {
- orgHumanResourceService.updateByPrimaryKeySelective(orgHumanResource);
- }
- return res;
- }
- /**
- * 企业参与国家标准或行业标准制定情况明细入口
- *
- * @param uid
- * 用户id
- * @return
- */
- @RequestMapping(value = "/standard", method = RequestMethod.POST)
- public Result standard(String uid, String standardName, String standardNumber, Integer standardLevel,
- Integer participateWay, String pageNo, String pageSize) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgStandardService.listOrgStandard(standardName, standardNumber, standardLevel, participateWay,
- pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 企业参与国家标准或行业标准制定情况明细修改保存
- *
- * @param orgStandard
- * @return
- */
- @RequestMapping(value = "/developStandard", method = RequestMethod.POST)
- public Result developStandard(OrgStandard orgStandard) {
- Result res = new Result();
- if (StringUtils.isBlank(orgStandard.getId())) {
- orgStandard.setId(UUID.randomUUID().toString());
- orgStandard.setDeletedSign(0);
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- orgStandard.setCreateTime(now.getTime());
- orgStandardService.insert(orgStandard);
- } else {
- orgStandardService.updateByPrimaryKeySelective(orgStandard);
- }
- res.setData(orgStandard);
- return res;
- }
- /**
- * 管理端录入+修改知识产权信息
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/intellectual", method = RequestMethod.POST)
- public Result intellectual(OrgIntellectualProperty orgIntellectualProperty, String authorizationDateFormattedDate,
- String uid) throws ParseException {
- Result res = new Result();
- if (!StringUtils.isBlank(authorizationDateFormattedDate)) {
- orgIntellectualProperty
- .setAuthorizationDate(DateUtils.parseDate(authorizationDateFormattedDate, "yyyy-MM-dd"));
- }
- if (null == orgIntellectualProperty.getId()) {
- orgIntellectualProperty.setId(UUID.randomUUID().toString());
- orgIntellectualProperty.setUid(uid);
- orgIntellectualProperty.setEvaluationCategory(
- (orgIntellectualProperty.getCatagory() >= 2 && orgIntellectualProperty.getCatagory() <= 4) ? 1 : 0);
- orgIntellectualProperty.setDeletedSign(0);
- res.setData(orgIntellectualPropertyService.insert(orgIntellectualProperty));
- } else {
- orgIntellectualProperty.setEvaluationCategory(orgIntellectualProperty.getCatagory() <= 2 ? 1 : 0);
- res.setData(orgIntellectualPropertyService.updateByPrimaryKeySelective(orgIntellectualProperty));
- }
- return res;
- }
- /**
- * 知识产权列表
- *
- * @param pageNo
- * @param pageSize
- * @return
- */
- @RequestMapping(value = "/intellectualList", method = RequestMethod.POST)
- public Result intellectualList(String pageNo, String pageSize, String uid) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgIntellectualPropertyService.listIntellectual(pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 上年度高新技术产品(服务)情况列表
- *
- * @param pageNo
- * @param pageSize
- * @return
- */
- @RequestMapping(value = "/techProductList", method = RequestMethod.POST)
- public Result techProductList(String pageNo, String pageSize, String uid) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgTechProductService.listTechProduct(pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 企业研究开发活动情况表入口
- *
- * @param activityNumber
- * @param activityName
- * @param startDate
- * @param endDate
- * @param pageNo
- * @param pageSize
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/activityList", method = RequestMethod.POST)
- public Result activityList(String activityNumber, String activityName, String startDateFormattedDate,
- String endDateFormattedDate, String pageNo, String pageSize, String uid) throws ParseException {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgActivityService.listOrgActivity(activityNumber, activityName, startDateFormattedDate,
- endDateFormattedDate, pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 企业研究开发活动情况新增、修改
- *
- * @param orgActivity
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/activity", method = RequestMethod.POST)
- public Result activity(OrgActivity orgActivity, String startDateFormattedDate, String endDateFormattedDate)
- throws ParseException {
- Result res = new Result();
- orgActivity.setDeletedSign(0);
- if (!StringUtils.isBlank(startDateFormattedDate)) {
- orgActivity.setStartDate(DateUtils.parseDate(startDateFormattedDate, "yyyy-MM-dd"));
- }
- if (StringUtils.isBlank(endDateFormattedDate)) {
- orgActivity.setEndDate(DateUtils.parseDate(endDateFormattedDate, "yyyy-MM-dd"));
- }
- if (StringUtils.isBlank(orgActivity.getId())) {
- orgActivity.setId(UUID.randomUUID().toString());
- orgActivity.setUid(TokenManager.getUserId());
- orgActivityService.insert(orgActivity);
- } else {
- orgActivityService.updateByPrimaryKeySelective(orgActivity);
- Boolean flag = false;
- OrgActivityCost cost = orgActivityCostService.selectOrgActivityCostByAid(orgActivity.getId());
- if (null != cost) {
- if (!StringUtils.isBlank(orgActivity.getActivityNumber())) {
- cost.setActivityNumber(orgActivity.getActivityNumber());
- flag = true;
- }
- if (null == orgActivity.getStartDate()) {
- cost.setStartDate(orgActivity.getStartDate());
- flag = true;
- }
- if (null == orgActivity.getEndDate()) {
- cost.setEndDate(orgActivity.getEndDate());
- flag = true;
- }
- }
- if (flag) {
- orgActivityCostService.updateByPrimaryKeySelective(cost);
- }
- }
- res.setData(orgActivity);
- return res;
- }
- /**
- * 企业年度研究开发费用结构明细表列表入口
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/activityCostList", method = RequestMethod.POST)
- public Result activityCostList(String activityNumber, String startDateFormattedDate, String endDateFormattedDate,
- String pageNo, String pageSize, String uid) throws ParseException {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgActivityCostService.listOrgActivityCost(activityNumber, startDateFormattedDate,
- endDateFormattedDate, pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 企业年度研究开发费用结构明细表(新增+修改)
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/activityCost", method = RequestMethod.POST)
- public Result activityCost(OrgActivityCost orgActivityCost, String signDateFormattedDate) throws ParseException {
- Result res = new Result();
- if (StringUtils.isBlank(signDateFormattedDate)) {
- orgActivityCost.setSignDate(DateUtils.parseDate(signDateFormattedDate, "yyyy-MM-dd"));
- }
- if (null == orgActivityCost.getId()) {
- OrgActivity ac = orgActivityService.selectOrgActivityByPrimaryKey(orgActivityCost.getAid());
- orgActivityCost.setStartDate(ac.getStartDate());
- orgActivityCost.setEndDate(ac.getEndDate());
- orgActivityCost.setId(UUID.randomUUID().toString());
- orgActivityCost.setUid(TokenManager.getUserId());
- orgActivityCost.setDeletedSign(0);
- orgActivityCostService.insert(orgActivityCost);
- } else {
- orgActivityCostService.updateByPrimaryKeySelective(orgActivityCost);
- }
- return res;
- }
- /**
- * 上年度高新技术产品(服务)情况(新增+修改)
- *
- * @param orgTechProduct
- * @return
- */
- @RequestMapping(value = "/techProduct", method = RequestMethod.POST)
- public Result techProduct(OrgTechProduct orgTechProduct) {
- Result res = new Result();
- if (null == orgTechProduct.getId()) {
- orgTechProduct.setId(UUID.randomUUID().toString());
- orgTechProduct.setDeletedSign(0);
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- orgTechProduct.setCreateTime(now.getTime());
- orgTechProduct.setYear(Calendar.getInstance().get(Calendar.YEAR) - 1);
- orgTechProductService.insert(orgTechProduct);
- } else {
- orgTechProductService.updateByPrimaryKeySelective(orgTechProduct);
- }
- res.setData(orgTechProduct);
- return res;
- }
- /**
- * 企业纳税申报信息入口
- *
- * @return
- */
- @RequestMapping(value = "/ratepay", method = RequestMethod.POST)
- public Result ratepay(Integer year, String pageNo, String pageSize, String uid) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgRatepayService.listOrgRatepay(year, pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 企业纳税申报信息录入+修改
- */
- @RequestMapping(value = "/disposeRatepay", method = RequestMethod.POST)
- public Result disposeRatepay(OrgRatepay orgRatepay) {
- Result res = new Result();
- if (null == orgRatepay.getId()) {
- if (null == orgRatepayService.selectRatepayByUidAndYear(orgRatepay.getUid(), orgRatepay.getYear())) {
- orgRatepay.setId(UUID.randomUUID().toString());
- orgRatepay.setDeletedSign(0);
- orgRatepayService.insert(orgRatepay);
- } else {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度纳税申报表已录入!"));
- return res;
- }
- } else {
- orgRatepayService.updateByPrimaryKeySelective(orgRatepay);
- }
- return res;
- }
- /**
- * 财务报表信息入口
- *
- * @return
- */
- @RequestMapping(value = "/finance", method = RequestMethod.POST)
- public Result finance(Integer year, String pageNo, String pageSize, String uid) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgFinanceService.listFinance(year, pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 财务报表录入+修改
- *
- * @param orgFinance
- * @return
- */
- @RequestMapping(value = "/disposeFinance", method = RequestMethod.POST)
- public Result disposeFinance(OrgFinance orgFinance) {
- Result res = new Result();
- if (null == orgFinance.getId()) {
- if (null == orgFinanceService.selectFinanceByUidAndYear(orgFinance.getUid(), orgFinance.getYear())) {
- orgFinance.setId(UUID.randomUUID().toString());
- orgFinance.setDeletedSign(0);
- orgFinanceService.insert(orgFinance);
- } else {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度财务报表已录入!"));
- return res;
- }
- } else {
- orgFinanceService.updateByPrimaryKeySelective(orgFinance);
- }
- return res;
- }
- /**
- * 获取当前用户已录入项目标号列表
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/activityNumber", method = RequestMethod.POST)
- public Result listActivityNumber(String uid) {
- Result res = new Result();
- List<ActivityNumberBo> activityNumberBo = orgActivityService.selectOrgActivityNumberBoByUid(uid);
- res.setData(activityNumberBo);
- return res;
- }
- /**
- * 科技成果转化情况列表入口
- *
- * @param pageNo
- * @param pageSize
- * @return
- */
- @RequestMapping(value = "/achievementList", method = RequestMethod.POST)
- public Result achievementList(String pageNo, String pageSize, String uid) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgTechAchievementService.listOrgTechAchievement(pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 科技成果转化情况新增+修改
- *
- * @param achievement
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeAchievement", method = RequestMethod.POST)
- public Result disposeAchievement(OrgTechAchievement achievement) throws ParseException {
- Result res = new Result();
- if (null == achievement.getId()) {
- achievement.setId(UUID.randomUUID().toString());
- achievement.setDeletedSign(0);
- orgTechAchievementService.inset(achievement);
- } else {
- orgTechAchievementService.updateByPrimaryKeySelective(achievement);
- }
- return res;
- }
- /**
- * 企业荣誉及其他证明材料列表入口
- *
- * @return
- */
- @RequestMapping(value = "/honorList", method = RequestMethod.POST)
- public Result honorList(String pageNo, String pageSize, String uid) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgHonorDatumService.listOrgHonorDatum(pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 企业荣誉及其他证明材料新增+修改
- *
- * @param achievement
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeHonor", method = RequestMethod.POST)
- public Result disposeHonor(OrgHonorDatum honor, String issuingTimeFormattedDate, String uid) throws ParseException {
- Result res = new Result();
- if (!StringUtils.isBlank(issuingTimeFormattedDate)) {
- honor.setIssuingTime(DateUtils.parseDate(issuingTimeFormattedDate, "yyyy-MM-dd"));
- }
- if (null == honor.getId()) {
- honor.setId(UUID.randomUUID().toString());
- honor.setUid(uid);
- honor.setDeletedSign(0);
- orgHonorDatumService.inset(honor);
- } else {
- orgHonorDatumService.updateByPrimaryKeySelective(honor);
- }
- return res;
- }
- /**
- * 技术中心入口
- *
- * @return
- */
- @RequestMapping(value = "/center", method = RequestMethod.POST)
- public Result center(String uid) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- res.setData(orgTechCenterService.selectOrgTechCenterByUid(uid));
- }
- return res;
- }
- /**
- * 技术中心新增+修改
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeCenter", method = RequestMethod.POST)
- public Result disposeCenter(OrgTechCenter orgTechCenter, String foundingTimeFormattedDate, String uid)
- throws ParseException {
- Result res = new Result();
- if (!StringUtils.isBlank(foundingTimeFormattedDate)) {
- orgTechCenter.setFoundingTime(DateUtils.parseDate(foundingTimeFormattedDate, "yyyy-MM-dd"));
- }
- if (null == orgTechCenter.getId()) {
- orgTechCenter.setId(UUID.randomUUID().toString());
- orgTechCenter.setUid(uid);
- orgTechCenter.setDeletedSign(0);
- orgTechCenterService.insert(orgTechCenter);
- } else {
- orgTechCenterService.updateByPrimaryKeySelective(orgTechCenter);
- }
- return res;
- }
- /**
- * 获取公司联系人
- *
- * @return
- */
- @RequestMapping(value = "/getContacts", method = RequestMethod.POST)
- public Result getContacts(String uid) {
- Result res = new Result();
- res.setData(organizationIdentityService.selectContactsByUserId(uid));
- return res;
- }
- /**
- * 申请高企认定
- *
- * @return
- */
- @RequestMapping(value = "/applyCognizance", method = RequestMethod.POST)
- public Result applyCognizance(Integer contacts, String comment, String consultant, String uid, Integer year,
- Integer state) {
- Result res = new Result();
- if (null != orgCognizanceService.selectCognizanceByUidAndYear(year, uid)) {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年度高企认定已申请!"));
- }
- OrgCognizance c = new OrgCognizance();
- c.setId(UUID.randomUUID().toString());
- c.setUid(uid);
- c.setContacts(contacts);
- c.setComment(comment);
- c.setConsultant(consultant);
- c.setYear(year);
- c.setDeletedSign(0);
- c.setState(state);
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- c.setRecordTime(now.getTime());
- orgCognizanceService.insert(c);
- OrgCognizanceLog log = new OrgCognizanceLog();
- log.setId(UUID.randomUUID().toString());
- log.setCid(c.getId());
- log.setRecordTime(c.getCreateTime());
- log.setState(state);
- log.setComment(comment);
- log.setPrincipal(userService.selectByPrimaryKey(uid).getAid());
- log.setOperator(TokenManager.getAdminId());
- orgCognizanceLogService.insert(log);
- return res;
- }
- /**
- * 高企认定列表入口
- *
- * @param locationProvince
- * @param unitName
- * @return
- */
- @RequestMapping(value = "/listCognizance", method = RequestMethod.POST)
- public Result listCognizance(String uid, String locationProvince, String pageNo, String pageSize) {
- Result res = new Result();
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgCognizanceService.listCognizance(uid, locationProvince, pNo, pSize));
- return res;
- }
- /**
- * 高企认定流转状态
- *
- * @param cid
- * @return
- */
- @RequestMapping(value = "/cognizanceLog", method = RequestMethod.POST)
- public Result cognizanceLog(String cid) {
- Result res = new Result();
- List<OrgCognizanceLog> list = orgCognizanceLogService.selectOrgCognizanceLogByCid(cid);
- res.setData(list);
- return res;
- }
- /**
- * 高企认定详情入口
- *
- * @param uid
- * @param cid
- * @return
- */
- @RequestMapping(value = "/cognizanceDetail", method = RequestMethod.POST)
- public Result cognizanceDetail(String uid, String cid, Integer year) {
- Result res = new Result();
- res.setData(handleCognizanceDetail(uid, cid, year));
- return res;
- }
- /**
- * 保存高企认定详情
- *
- * @throws ParseException
- */
- @RequestMapping(value = "/disposeCognizanceDetail", method = RequestMethod.POST)
- public Result disposeCognizanceDetail(OrgCognizance cog, OrgCognizanceLog log, String recordTimeFormattedDate)
- throws ParseException {
- Result res = new Result();
- if (null != log.getState()) {
- cog.setState(log.getState());
- switch (log.getState()) {
- case 1:
- cog.setCreateTime(log.getRecordTime());
- break;
- case 2:
- cog.setAcceptDate(log.getRecordTime());
- break;
- case 5:
- cog.setIssuingDate(log.getRecordTime());
- break;
- }
- log.setId(UUID.randomUUID().toString());
- log.setCid(cog.getId());
- log.setOperator(TokenManager.getAdminId());
- if (!StringUtils.isBlank(recordTimeFormattedDate)) {
- log.setRecordTime(DateUtils.parseDate(recordTimeFormattedDate, "yyyy-MM-dd"));
- }
- orgCognizanceLogService.insert(log);
- }
- orgCognizanceService.updateByPrimaryKeySelective(cog);
- return res;
- }
- /**
- * 刪除高企认定
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteCognizance", method = RequestMethod.POST)
- public Result deleteAnnualReport(@RequestParam(name = "ids[]", required = true) String[] ids) {
- Result res = new Result();
- List<String> id = new ArrayList<String>();
- for (String s : ids) {
- id.add(s);
- }
- res.setData(orgCognizanceService.batchDeleteByPrimaryKey(id));
- return res;
- }
- /**
- * 企业创新能力入口
- *
- * @param uid
- * @return
- */
- @RequestMapping(value = "/able", method = RequestMethod.POST)
- public Result able(String uid) {
- Result res = new Result();
- res.setData(userAbilityService.selectUserAbilityByUserId(uid));
- return res;
- }
- /**
- * 企业创新能力新增+保存
- *
- * @param u
- * @return
- */
- @RequestMapping(value = "/disposeAble", method = RequestMethod.POST)
- public Result disposeAble(UserAbility u) {
- Result res = new Result();
- if (null == u.getId()) {
- u.setId(UUID.randomUUID().toString());
- userAbilityService.insert(u);
- } else {
- userAbilityService.updateByPrimaryKeySelective(u);
- }
- return res;
- }
- /**
- * 年报列表
- *
- * @return
- */
- @RequestMapping(value = "/annualReport", method = RequestMethod.POST)
- public Result annualReport(String uid, Integer year, Integer state, String pageSize, String pageNo) {
- Result res = new Result();
- res = checkCertify(res, uid);
- if (res.getError().isEmpty()) {
- Integer pNo = 1;
- Integer pSize = 10;
- if (StringUtils.isNumeric(pageSize)) {
- pSize = Integer.parseInt(pageSize);
- }
- if (StringUtils.isNumeric(pageNo)) {
- pNo = Integer.parseInt(pageNo);
- }
- res.setData(orgAnnualReportService.listOrgAnnualReport(year, state, pNo, pSize, uid));
- }
- return res;
- }
- /**
- * 企业年报详情
- *
- * @param uid
- * @param year
- * @return
- */
- @RequestMapping(value = "/annualReportDetail", method = RequestMethod.POST)
- public Result annualReportDetail(String uid, Integer year) {
- Result res = new Result();
- res.setData(handleAnnualReport(uid, year));
- return res;
- }
- /**
- * 高企年报新增+修改
- *
- * @param orgAnnualReport
- * @return
- */
- @RequestMapping(value = "/disposeAnnualReport", method = RequestMethod.POST)
- public Result disposeAnnualReport(OrgAnnualReport orgAnnualReport) {
- Result res = new Result();
- if (null == orgAnnualReport.getId()) {
- if (null != orgAnnualReportService.selectAnnualReportByYearAndUid(orgAnnualReport.getYear(),
- orgAnnualReport.getUid())) {
- res.getError().add(buildError(ErrorConstants.DUPLICATE_DATA_ERROR, "当年企业年报已录入!"));
- return res;
- } else {
- orgAnnualReport.setId(UUID.randomUUID().toString());
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- orgAnnualReport.setCreateTime(now.getTime());
- orgAnnualReport.setLastUpdateTime(orgAnnualReport.getCreateTime());
- orgAnnualReport.setDeletedSign(0);
- orgAnnualReportService.insert(orgAnnualReport);
- }
- } else {
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- orgAnnualReport.setLastUpdateTime(now.getTime());
- orgAnnualReportService.updateByPrimaryKeySelective(orgAnnualReport);
- }
- return res;
- }
- /**
- * 上传相关模版
- *
- * @param req
- * @return
- */
- @RequestMapping(value = "/uploadTemplate", method = RequestMethod.POST)
- public Result uploadPatentTemplate(HttpServletRequest req, String sign) {
- Result res = new Result();
- System.out.println("init");
- String fileName = "";
- List<MultipartFile> files = getFiles(req);
- MultipartFile mf = files.get(0);
- String suffix = mf.getOriginalFilename().substring(mf.getOriginalFilename().lastIndexOf("."));
- System.err.println("suffix" + " " + suffix);
- if (suffix.equals(".doc") || suffix.equals(".docx")) {
- if ("patent_prory_statement".equals(sign)) {
- fileName = "patent_prory_statement" + suffix;
- } else {
- fileName = System.nanoTime() + "";
- }
- String name = handleFile(res, req, fileName, files, mf);
- res.setData(name);
- System.out.println(name);
- if (res.getData() != "" && res.getData() != null && null == aftFileService.selectAftFileBySign(sign)) {
- AftFile f = new AftFile();
- f.setId(UUID.randomUUID().toString());
- if ("patent_prory_statement".equals(sign)) {
- f.setFileName("专利代理委托书模版");
- f.setSign(sign);
- }
- f.setFilePath("/admin/" + fileName);
- f.setDeleletedSign(0);
- aftFileService.insert(f);
- }
- } else {
- res.getError().add(buildError(ErrorConstants.FILE_PATTERN_ERROR, "文件格式错误,请重新上传!"));
- }
- return res;
- }
- /**
- *
- * @return
- */
- // 判断用户是否通过认证
- private Result checkCertify(Result res, String uid) {
- OrganizationIdentity o = organizationIdentityService.selectOrgIdentityByUserId(uid);
- if (null == o || 5 != o.getAuditStatus()) {
- res.getError().add(buildError(ErrorConstants.NON_CERTIFIED, "未通过实名认证,无法操作!"));
- }
- return res;
- }
- // org团体列表
- private Pagination<OrgListBo> getOrgList(String mobile, String email, String[] createTime, Integer number,
- String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
- return userService.listOrg(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize);
- }
- // user个人列表
- private Pagination<UserListBo> getUserList(String mobile, String email, String[] createTime, Integer number,
- String aftUsername, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException {
- return userService.listUser(mobile, email, createTime, number, aftUsername, auditStatus, pNo, pSize);
- }
- // 高企详情
- private CognizanceDetailBo handleCognizanceDetail(String uid, String cid, Integer year) {
- return orgCognizanceService.selectCognizanceDetailBo(uid, cid, year);
- }
- // 年报
- private AnnualReportBo handleAnnualReport(String uid, Integer year) {
- return orgAnnualReportService.selectAnnualReportBo(uid, year);
- }
- private String handleFile(Result res, HttpServletRequest req, String fileName, List<MultipartFile> files,
- MultipartFile mf) {
- if (!files.isEmpty()) {
- try {
- mf.transferTo(toAdminPrivateFile(fileName));
- LoggerUtils.debug(getClass(), fileName + " 文件上传成功");
- } catch (IllegalStateException | IOException e) {
- LoggerUtils.error(getClass(), "文件上传失败", e);
- res.getError().add(buildError("", "文件上传失败!"));
- return "";
- }
- } else {
- res.getError().add(buildError("", "文件上传失败!"));
- return "";
- }
- return fileName;
- }
- }
|