| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- package com.goafanti.admin.controller;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- import java.util.UUID;
- import javax.annotation.Resource;
- import org.apache.commons.lang3.StringUtils;
- 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 com.alibaba.fastjson.JSON;
- import com.alibaba.fastjson.JSONArray;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.constant.ErrorConstants;
- import com.goafanti.common.controller.CertifyApiController;
- import com.goafanti.common.enums.DeleteStatus;
- import com.goafanti.common.model.LegalPersonOwnership;
- import com.goafanti.user.service.LegalPersonOwnershipService;
- import com.goafanti.user.service.NatureOwnershipService;
- @Controller
- @RequestMapping(value = "/api/admin/basic")
- public class AdminOrgBaiscInfoApiController extends CertifyApiController {
- @Resource
- private LegalPersonOwnershipService legalPersonOwnershipService;
- @Resource
- private NatureOwnershipService natureOwnershipService;
- /**
- * 法人股权人列表
- */
- @RequestMapping(value = "/listLegalPerson", method = RequestMethod.GET)
- public Result listLegalPerson(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- res.setData(legalPersonOwnershipService.selectByUid(uid));
- return res;
- }
-
- /**
- * 法人股权人保存修改
- * @return
- */
- @RequestMapping(value = "/legalPerson", method = RequestMethod.POST)
- public Result legalPerson(String data){
- Result res = new Result();
- JSONArray ja = (JSONArray) JSON.parse(data);
- if (ja != null && !ja.isEmpty()) {
- List<LegalPersonOwnership> lpo = new ArrayList<LegalPersonOwnership>();
- for (int idx = 0; idx < ja.size(); idx++) {
- lpo.add(ja.getJSONObject(idx).toJavaObject(LegalPersonOwnership.class));
- }
- for (LegalPersonOwnership l : lpo){
-
- if (StringUtils.isBlank(l.getId())){
- l.setId(UUID.randomUUID().toString());
- }
-
- if (null == l.getDeletedSign()){
- l.setDeletedSign(DeleteStatus.UNDELETE.getCode());
- }
- }
- res.setData(legalPersonOwnershipService.batchInsert(lpo));
- } else {
- res.getError().add(buildError("", "参数格式不正确"));
- }
- return res;
- }
- /**
- * 删除自然股权人
- *
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteLegalPerson", method = RequestMethod.POST)
- public Result deleteLegalPerson(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(legalPersonOwnershipService.batchDeleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
-
- /**
- * 自然人股权列表
- * @param uid
- * @return
- */
- @RequestMapping(value = "/listNature", method = RequestMethod.GET)
- public Result listNature(String uid) {
- Result res = new Result();
- if (StringUtils.isBlank(uid)) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户", "用户"));
- return res;
- }
- res.setData(natureOwnershipService.selectByUid(uid));
- return res;
- }
-
- /**
- * 删除自然人股权
- * @param ids
- * @return
- */
- @RequestMapping(value = "/deleteNature", method = RequestMethod.POST)
- public Result deleteNature(@RequestParam(name = "ids[]", required = false) String[] ids) {
- Result res = new Result();
- if (ids == null || ids.length < 1) {
- res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
- } else {
- res.setData(natureOwnershipService.batchDeleteByPrimaryKey(Arrays.asList(ids)));
- }
- return res;
- }
- }
|