| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package com.goafanti.customer.controller;
- import java.text.ParseException;
- import java.util.UUID;
- import javax.annotation.Resource;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import com.goafanti.customer.service.CustomerOrganizationService;
- import com.goafanti.customer.service.CustomerService;
- import com.goafanti.customer.service.CustomerUserService;
- import com.goafanti.common.bo.Result;
- import com.goafanti.common.controller.CertifyApiController;
- import com.goafanti.common.model.Customer;
- import com.goafanti.common.model.CustomerOrganizationInfo;
- import com.goafanti.common.model.CustomerUserInfo;
- import com.goafanti.core.shiro.token.TokenManager;
- @RestController
- @RequestMapping(value = "/api/admin/customer")
- public class AdminCustomerApiController extends CertifyApiController {
- @Resource
- private CustomerService customerService;
- @Resource
- private CustomerUserService customerUserService;
- @Resource
- private CustomerOrganizationService customerOrganizationService;
- /**
- * 新增客户
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/addCustomer", method = RequestMethod.POST)
- public Result addCustomer(Customer cus,CustomerOrganizationInfo coi,CustomerUserInfo cui) throws ParseException {
- Result res=new Result();
- /*生成cutomerid*/
- String cid = UUID.randomUUID().toString();
- cus.setId(cid);
- /*获取admin的id*/
- cus.setAid(TokenManager.getUserId());
- /*插入客户信息*/
- int result = customerService.addCustomer(cus);
- if(result>0) {
- /*插入客户个人信息*/
- cui.setCid(cid);
- cui.setId(UUID.randomUUID().toString());
- customerUserService.addCustomerUser(cui);
- /*插入客户公司信息*/
- coi.setCid(cid);
- coi.setId(UUID.randomUUID().toString());
- customerOrganizationService.addCustomerOrganization(coi);
- }
- return res;
- }
-
-
- /**
- * 删除
- *
- * @return
- * @throws ParseException
- */
- @RequestMapping(value = "/deleteCustomer", method = RequestMethod.POST)
- public Result deleteCustomer(String id) throws ParseException {
- Result res=new Result();
-
- return res;
- }
- }
|