Forráskód Böngészése

客户表字段拆分开发

anderx 7 éve%!(EXTRA string=óta)
szülő
commit
224344eaf7

+ 2 - 0
src/main/java/com/goafanti/common/dao/OrganizationAnnualReportMapper.java

@@ -93,4 +93,6 @@ public interface OrganizationAnnualReportMapper {
      * @mbg.generated Fri Jul 20 16:32:29 CST 2018
      */
     int updateByPrimaryKey(OrganizationAnnualReport record);
+
+	int checkYear(Integer year);
 }

+ 18 - 0
src/main/java/com/goafanti/common/mapper/OrganizationAnnualReportMapper.xml

@@ -315,4 +315,22 @@
       aid = #{aid,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
+  <select id="checkYear" parameterType="integer" resultType="integer">
+  	select count(*) from organization_annual_report where year = #{year,jdbcType=INTEGER} 
+  </select>
+  <select id="selectOrgAnnualList" resultMap="BaseResultMap">
+   select 
+  <include refid="Base_Column_List" />
+  from organization_annual_report
+  where uid= #{uid,jdbcType=VARCHAR}
+  <if test="page_sql != null">
+    		${page_sql}
+   		</if>
+	</select>
+	<select id="selectOrgAnnualCount" resultType="java.lang.Integer">
+		select 
+			count(0)
+			from organization_annual_report
+		 where uid= #{uid,jdbcType=VARCHAR}
+	</select>
 </mapper>

+ 3 - 67
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -52,7 +52,7 @@ import com.goafanti.customer.bo.CustomerPersonalDetailBo;
 import com.goafanti.customer.bo.FollowBusinessBo;
 import com.goafanti.customer.bo.UserDetailBo;
 import com.goafanti.customer.service.CustomerService;
-import com.goafanti.customer.service.OrgAnnualReportService;
+import com.goafanti.customer.service.impl.AdminOrgAnnualReportServiceImpl;
 
 @RestController
 @RequestMapping("/api/admin/customer")
@@ -60,7 +60,7 @@ public class AdminCustomerApiController extends BaseApiController{
 	@Resource
 	private CustomerService customerService;
 	@Resource
-	private OrgAnnualReportService orgAnnualReportService;
+	private AdminOrgAnnualReportServiceImpl adminOrgAnnualReportService;
 	@Resource
 	private AftFileService aftFileService;
 	@Value(value = "${upload.private.path}")
@@ -1077,71 +1077,7 @@ public class AdminCustomerApiController extends BaseApiController{
 		}
 		return res;
 	}
-	/**
-	 * 新增客户年报
-	 **/
-	@RequestMapping(value = "/addOrgAnnual", method = RequestMethod.GET)
-	public Result addOrgAnnual(OrganizationAnnualReport o) {
-		Result res=new Result();
-		if (StringUtils.isEmpty(o.getUid())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID"));
-			return res;
-		}
-		res.setData(orgAnnualReportService.addOrgAnnual(o));
-		return res;
-	}
-	/**
-	 * 新增客户年报
-	 **/
-	@RequestMapping(value = "/delectOrgAnnual", method = RequestMethod.GET)
-	public Result delectOrgAnnual(OrganizationAnnualReport o) {
-		Result res=new Result();
-		if (StringUtils.isEmpty(o.getId())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
-			return res;
-		}
-		res.setData(orgAnnualReportService.delectOrgAnnual(o.getId()));
-		return res;
-	}
-	/**
-	 * 查看客户年报
-	 **/
-	@RequestMapping(value = "/delectOrgAnnual", method = RequestMethod.GET)
-	public Result selectOrgAnnual(OrganizationAnnualReport o) {
-		Result res=new Result();
-		if (StringUtils.isEmpty(o.getId())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
-			return res;
-		}
-		res.setData(orgAnnualReportService.selectOrgAnnual(o.getId()));
-		return res;
-	}
-	/**
-	 * 修改客户年报
-	 **/
-	@RequestMapping(value = "/updateOrgAnnual", method = RequestMethod.GET)
-	public Result updateOrgAnnual(OrganizationAnnualReport o) {
-		Result res=new Result();
-		if (StringUtils.isEmpty(o.getId())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
-			return res;
-		}
-		res.setData(orgAnnualReportService.updateOrgAnnual(o));
-		return res;
-	}
-	/**
-	 * 客户年报列表
-	 **/
-	@RequestMapping(value = "/updateOrgAnnual", method = RequestMethod.GET)
-	public Result selectListOrgAnnual(OrganizationAnnualReport o) {
-		Result res=new Result();
-		if (StringUtils.isEmpty(o.getId())) {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
-			return res;
-		}
-		res.setData(orgAnnualReportService.selectListOrgAnnual(o));
-		return res;
-	}
+	
 }
 
 

+ 196 - 0
src/main/java/com/goafanti/customer/controller/OrganizationAnnualReportController.java

@@ -0,0 +1,196 @@
+package com.goafanti.customer.controller;
+
+
+import javax.annotation.Resource;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import com.goafanti.admin.service.AdminService;
+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.OrganizationAnnualReport;
+import com.goafanti.common.model.OrganizationYearProject;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.customer.service.AdminOrgAnnualReportService;
+import com.goafanti.customer.service.CustomerService;
+import com.goafanti.customer.service.impl.AdminOrgAnnualReportServiceImpl;
+
+@RestController
+@RequestMapping("/open/api/admin/customers")
+public class OrganizationAnnualReportController extends BaseApiController{
+	@Resource
+	private CustomerService customerService;
+	@Resource
+	private AdminOrgAnnualReportService adminOrgAnnualReportService;
+	@Resource
+	private AftFileService aftFileService;
+	@Value(value = "${upload.private.path}")
+	private String	uploadPrivatePath	= null;
+	@Resource
+	private AdminService adminService;
+	
+	@Value(value = "${aesSecretKey}")
+	private String							secretKey	= null;
+	
+	/**
+	 * 新增客户年报
+	 **/
+	@RequestMapping(value = "/addOrgAnnual", method = RequestMethod.GET)
+	public Result addOrgAnnual(OrganizationAnnualReport o) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getUid())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID"));
+			return res;
+		}
+		if (null==o.getYear()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
+			return res;
+		}
+		if (adminOrgAnnualReportService.checkYear(o.getYear())) {
+			res.getError().add(buildError("", "年份已存在", "年份已存在"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.addOrgAnnual(o));
+		return res;
+	}
+	/**
+	 * 删除客户年报
+	 **/
+	@RequestMapping(value = "/delectOrgAnnual", method = RequestMethod.GET)
+	public Result delectOrgAnnual(OrganizationAnnualReport o) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.delectOrgAnnual(o.getId()));
+		return res;
+	}
+	/**
+	 * 查看客户年报
+	 **/
+	@RequestMapping(value = "/selectOrgAnnual", method = RequestMethod.GET)
+	public Result selectOrgAnnual(OrganizationAnnualReport o) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.selectOrgAnnual(o.getId()));
+		return res;
+	}
+	/**
+	 * 修改客户年报
+	 **/
+	@RequestMapping(value = "/updateOrgAnnual", method = RequestMethod.GET)
+	public Result updateOrgAnnual(OrganizationAnnualReport o) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
+			return res;
+		}
+		if (null==o.getYear()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.updateOrgAnnual(o));
+		return res;
+	}
+	/**
+	 * 客户年报列表
+	 **/
+	@RequestMapping(value = "/selectListOrgAnnual", method = RequestMethod.GET)
+	public Result selectListOrgAnnual(OrganizationAnnualReport o,Integer pNo,Integer pSize) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getUid())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "客户ID"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.selectListOrgAnnual(o,pNo,pSize));
+		return res;
+	}
+	/**
+	 * 新增客户年份项目
+	 **/
+	@RequestMapping(value = "/addOrgYearProject", method = RequestMethod.GET)
+	public Result addOrgYearProject(OrganizationYearProject o) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getUid())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户ID"));
+			return res;
+		}
+		if (null==o.getYear()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
+			return res;
+		}
+		if (adminOrgAnnualReportService.checkYear(o.getYear())) {
+			res.getError().add(buildError("", "年份已存在", "年份已存在"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.addOrgYearProject(o));
+		return res;
+	}
+	/**
+	 * 删除客户年份项目
+	 **/
+	@RequestMapping(value = "/delectOrgYearProject", method = RequestMethod.GET)
+	public Result delectOrgYearProject(OrganizationYearProject o) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.delectOrgYearProject(o.getId()));
+		return res;
+	}
+	/**
+	 * 查看客户年份项目
+	 **/
+	@RequestMapping(value = "/selectOrgYearProject", method = RequestMethod.GET)
+	public Result selectOrgYearProject(OrganizationYearProject o) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.selectOrgYearProject(o.getId()));
+		return res;
+	}
+	/**
+	 * 修改客户年份项目
+	 **/
+	@RequestMapping(value = "/updateOrgYearProject", method = RequestMethod.GET)
+	public Result updateOrgYearProject(OrganizationYearProject o) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "ID"));
+			return res;
+		}
+		if (null==o.getYear()) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "年份"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.updateOrgYearProject(o));
+		return res;
+	}
+	/**
+	 * 客户年份项目列表
+	 **/
+	@RequestMapping(value = "/selectListOrgYearProject", method = RequestMethod.GET)
+	public Result selectListOrgYearProject(OrganizationYearProject o,Integer pNo,Integer pSize) {
+		Result res=new Result();
+		if (StringUtils.isEmpty(o.getUid())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "客户ID"));
+			return res;
+		}
+		res.setData(adminOrgAnnualReportService.selectListOrgYearProject(o,pNo,pSize));
+		return res;
+	}
+}
+
+
+

+ 31 - 0
src/main/java/com/goafanti/customer/service/AdminOrgAnnualReportService.java

@@ -0,0 +1,31 @@
+package com.goafanti.customer.service;
+
+import com.goafanti.common.model.OrganizationAnnualReport;
+import com.goafanti.common.model.OrganizationYearProject;
+import com.goafanti.core.mybatis.page.Pagination;
+
+public interface AdminOrgAnnualReportService {
+
+	int addOrgAnnual(OrganizationAnnualReport o);
+
+	int delectOrgAnnual(String id);
+
+	OrganizationAnnualReport selectOrgAnnual(String id);
+
+	int updateOrgAnnual(OrganizationAnnualReport o);
+
+	Pagination<OrganizationAnnualReport> selectListOrgAnnual(OrganizationAnnualReport o, Integer pNo, Integer pSize);
+
+	boolean checkYear(Integer year);
+
+	int addOrgYearProject(OrganizationYearProject o);
+
+	int delectOrgYearProject(String id);
+
+	OrganizationYearProject selectOrgYearProject(String id);
+
+	int updateOrgYearProject(OrganizationYearProject o);
+
+	Pagination<OrganizationYearProject> selectListOrgYearProject(OrganizationYearProject o, Integer pNo, Integer pSize);
+
+}

+ 0 - 19
src/main/java/com/goafanti/customer/service/OrgAnnualReportService.java

@@ -1,19 +0,0 @@
-package com.goafanti.customer.service;
-
-import java.util.List;
-
-import com.goafanti.common.model.OrganizationAnnualReport;
-
-public interface OrgAnnualReportService {
-
-	int addOrgAnnual(OrganizationAnnualReport o);
-
-	int delectOrgAnnual(String id);
-
-	OrganizationAnnualReport selectOrgAnnual(String id);
-
-	int updateOrgAnnual(OrganizationAnnualReport o);
-
-	List<OrganizationAnnualReport> selectListOrgAnnual(OrganizationAnnualReport o);
-
-}

+ 101 - 0
src/main/java/com/goafanti/customer/service/impl/AdminOrgAnnualReportServiceImpl.java

@@ -0,0 +1,101 @@
+package com.goafanti.customer.service.impl;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.goafanti.common.dao.OrganizationAnnualReportMapper;
+import com.goafanti.common.dao.OrganizationYearProjectMapper;
+import com.goafanti.common.model.OrganizationAnnualReport;
+import com.goafanti.common.model.OrganizationYearProject;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.customer.service.AdminOrgAnnualReportService;
+@Service
+public class AdminOrgAnnualReportServiceImpl  extends BaseMybatisDao<OrganizationAnnualReportMapper> implements AdminOrgAnnualReportService {
+	@Autowired
+	private OrganizationAnnualReportMapper	organizationAnnualReportMapper;
+	@Autowired
+	private OrganizationYearProjectMapper	organizationYearProjectMapper;
+	
+	@Override
+	public int addOrgAnnual(OrganizationAnnualReport o) {
+		o.setId(UUID.randomUUID().toString());
+//		o.setAid(TokenManager.getAdminId());
+		o.setAid("1");
+		return organizationAnnualReportMapper.insert(o);
+	}
+
+	@Override
+	public int delectOrgAnnual(String id) {
+		return organizationAnnualReportMapper.deleteByPrimaryKey(id);
+	}
+
+	@Override
+	public OrganizationAnnualReport selectOrgAnnual(String id) {
+		return organizationAnnualReportMapper.selectByPrimaryKey(id);
+	}
+
+	@Override
+	public int updateOrgAnnual(OrganizationAnnualReport o) {
+		return organizationAnnualReportMapper.updateByPrimaryKey(o);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<OrganizationAnnualReport> selectListOrgAnnual(OrganizationAnnualReport o, Integer pNo, Integer pSize) {
+		if(null==pNo)pNo=1;
+		if(null==pSize)pSize=10;
+		Map<String,Object> params = new HashMap<>();
+		params.put("uid", o.getUid());
+		Pagination<OrganizationAnnualReport> list = (Pagination<OrganizationAnnualReport>) findPage("selectOrgAnnualList","selectOrgAnnualCount",params,pNo,pSize);
+		return list;
+		
+	}
+	@Override
+	public boolean checkYear(Integer year) {
+		int i=organizationAnnualReportMapper.checkYear(year);
+		if(i>1)return true;
+		return false;
+	}
+
+	@Override
+	public int addOrgYearProject(OrganizationYearProject o) {
+		o.setId(UUID.randomUUID().toString());
+//		o.setAid(TokenManager.getAdminId());
+		o.setAid("1");
+		return organizationYearProjectMapper.insert(o);
+	}
+
+	@Override
+	public int delectOrgYearProject(String id) {
+		return organizationYearProjectMapper.deleteByPrimaryKey(id);
+	}
+
+	@Override
+	public OrganizationYearProject selectOrgYearProject(String id) {
+		return organizationYearProjectMapper.selectByPrimaryKey(id);
+	}
+
+	@Override
+	public int updateOrgYearProject(OrganizationYearProject o) {
+		return organizationYearProjectMapper.updateByPrimaryKey(o);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<OrganizationYearProject> selectListOrgYearProject(OrganizationYearProject o, Integer pNo,
+			Integer pSize) {
+		if(null==pNo)pNo=1;
+		if(null==pSize)pSize=10;
+		Map<String,Object> params = new HashMap<>();
+		params.put("uid", o.getUid());
+		Pagination<OrganizationYearProject> list = (Pagination<OrganizationYearProject>) findPage("selectOrgYearProjectList","selectOrgYearProjectCount",params,pNo,pSize);
+		return list;
+		
+	}
+	
+
+}

+ 0 - 47
src/main/java/com/goafanti/customer/service/impl/OrgAnnualReportServiceImpl.java

@@ -1,47 +0,0 @@
-package com.goafanti.customer.service.impl;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.goafanti.common.dao.OrganizationAnnualReportMapper;
-import com.goafanti.common.dao.UserMapper;
-import com.goafanti.common.model.OrganizationAnnualReport;
-import com.goafanti.core.mybatis.BaseMybatisDao;
-import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.customer.service.OrgAnnualReportService;
-
-public class OrgAnnualReportServiceImpl  extends BaseMybatisDao<UserMapper> implements OrgAnnualReportService {
-	@Autowired
-	private OrganizationAnnualReportMapper	organizationAnnualReportMapper;
-	
-	@Override
-	public int addOrgAnnual(OrganizationAnnualReport o) {
-		o.setId(UUID.randomUUID().toString());
-		o.setAid(TokenManager.getAdminId());
-		return organizationAnnualReportMapper.insert(o);
-	}
-
-	@Override
-	public int delectOrgAnnual(String id) {
-		return organizationAnnualReportMapper.deleteByPrimaryKey(id);
-	}
-
-	@Override
-	public OrganizationAnnualReport selectOrgAnnual(String id) {
-		return organizationAnnualReportMapper.selectByPrimaryKey(id);
-	}
-
-	@Override
-	public int updateOrgAnnual(OrganizationAnnualReport o) {
-		return organizationAnnualReportMapper.updateByPrimaryKey(o);
-	}
-
-	@Override
-	public List<OrganizationAnnualReport> selectListOrgAnnual(OrganizationAnnualReport o) {
-		
-		return null;
-	}
-
-}