package com.goafanti.admin.controller; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.UUID; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; 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.CustomerService; import com.goafanti.common.bo.Result; import com.goafanti.common.controller.CertifyApiController; import com.goafanti.common.model.Customer; import com.goafanti.core.mybatis.page.Pagination; import com.goafanti.core.shiro.token.TokenManager; @RestController @RequestMapping(value = "/api/admin/customer") public class AdminCustomerApiController extends CertifyApiController { @Resource private CustomerService customerService; /** * 新增客户 * * @return * @throws ParseException */ @RequestMapping(value = "/addCustomer", method = RequestMethod.POST) public Result addCustomer(String createTime, String companyName, String companyIndustry, String companyIntention, String adress, String customerName, String mobile, String email, String qq, String wechat, String customerPosition, String remark, String province, String fllowSituation, int sex, String customerStatue, String department, int customerTyp, String telNum) throws ParseException { Customer cus = new Customer(); Result res = new Result(); cus.setAdress(adress); cus.setCompanyIndustry(companyIndustry); cus.setCompanyIntention(companyIntention); cus.setCompanyName(companyName); if (null != createTime && createTime != "") { cus.setCreateTime((new SimpleDateFormat("yyyy-MM-dd").parse(createTime))); } cus.setCustomerName(customerName); cus.setCustomerPosition(customerPosition); cus.setCustomerStatue(customerStatue); cus.setCustomerTyp(customerTyp); cus.setDepartment(department); cus.setEmail(email); cus.setFllowSituation(fllowSituation); cus.setId(UUID.randomUUID().toString()); cus.setMobile(mobile); cus.setAid(TokenManager.getUserId()); cus.setProvince(province); cus.setQq(qq); cus.setRemark(remark); cus.setSex(sex); cus.setTelNum(telNum); cus.setWechat(wechat); customerService.addCustomer(cus); return res; } /** * 删除客户信息 * * @return */ @RequestMapping(value = "/deleteCustomer", method = RequestMethod.GET) public int deleteCustomer(HttpServletRequest req, String id) { int res = customerService.deleteCustomer(id); return res; } /** * 查询客户信息 * * @return */ @RequestMapping(value = "/SearchCustomerList", method = RequestMethod.GET) public Result SearchCustomerList(String companyName, Integer customerTyp, String province, String customerName, String telNum, String customerStatue, String CompanyIntention, String fllowSituation,Integer pageNo,Integer pageSize) { Result res =new Result(); res.setData(customerService.findCustomerByPage(companyName, customerTyp, province, customerName, telNum, customerStatue, CompanyIntention, fllowSituation,pageNo,pageSize)); return res; } }