| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- package com.goafanti.weChat.controller;
- import java.util.List;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- 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.common.bo.Result;
- import com.goafanti.common.constant.ErrorConstants;
- import com.goafanti.common.controller.CertifyApiController;
- import com.goafanti.common.utils.StringUtils;
- import com.goafanti.common.utils.excel.NewExcelUtil;
- import com.goafanti.weChat.bo.InputPublicDtails;
- import com.goafanti.weChat.bo.InputPublicRelease;
- import com.goafanti.weChat.bo.InputPublicReleaseList;
- import com.goafanti.weChat.bo.InputPublicStatistics;
- import com.goafanti.weChat.bo.OutPublicDtails;
- import com.goafanti.weChat.bo.OutPublicStatistics;
- import com.goafanti.weChat.service.PublicReleaseService;
- @RestController
- @RequestMapping(value = "/api/admin/release")
- public class AdminReleaseApiController extends CertifyApiController{
- @Resource
- private PublicReleaseService publicReleaseService;
- @Value(value = "${upload.path}")
- private String uploadPath = null;
- /**
- * 发起外出申请
- */
- @RequestMapping(value = "/addPublicRelease", method = RequestMethod.POST)
- public Result addPublicRelease(InputPublicRelease in){
- Result res = new Result();
- if (StringUtils.isBlank(in.getUid())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"用户编号"));
- return res;
- }
- if (StringUtils.isBlank(in.getReleaseStarts())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出时间"));
- return res;
- }
- if (StringUtils.isBlank(in.getUserName())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出地点"));
- return res;
- }
- if (publicReleaseService.checkTime(in)) {
- res.getError().add(buildError("公出时段已经被使用!","公出时段已经被使用!"));
- return res;
- }
- res.setData(publicReleaseService.addPublicRelease(in));
- return res;
- }
- /**
- * 修改外出申请
- * @return
- */
- @RequestMapping(value = "/updatePublicRelease", method = RequestMethod.POST)
- public Result updatePublicRelease(InputPublicRelease in){
- Result res = new Result();
- if (publicReleaseService.checkTime(in)) {
- res.getError().add(buildError("公出时段已经被使用!","公出时段已经被使用!"));
- return res;
- }
- res.setData(publicReleaseService.updatePublicRelease(in));
- return res;
- }
- /**
- * 外出打卡、公出打卡
- * @return
- */
- @RequestMapping(value = "/publicReleaseClockIn", method = RequestMethod.POST)
- public Result publicReleaseClockIn(Integer id,String photoUrl){
- Result res =new Result();
- res.setData(publicReleaseService.pushPublicReleaseClockIn(id,photoUrl));
- return res;
- }
- /**
- * 外出申请详情
- * @return
- */
- @RequestMapping(value = "/dtails", method = RequestMethod.GET)
- public Result dtails(Integer id){
- Result res =new Result();
- res.setData(publicReleaseService.dtails(id));
- return res;
- }
- /**
- * 外出申请详情
- * @return
- */
- @RequestMapping(value = "/followDtails", method = RequestMethod.GET)
- public Result followDtails(String id){
- Result res =new Result();
- res.setData(publicReleaseService.followDtails(id));
- return res;
- }
- /**
- * 外出申请列表
- * @return
- */
- @RequestMapping(value = "/listPublicRelease", method = RequestMethod.GET)
- public Result listPublicRelease(InputPublicReleaseList in){
- Result res =new Result();
- res.setData(publicReleaseService.listPublicRelease(in));
- return res;
- }
- /**
- * 外出审核
- * @return
- */
- @RequestMapping(value = "/examinePublicRelease", method = RequestMethod.POST)
- public Result examinePublicRelease(Integer id ,Integer status,String remarks,Double duration){
- Result res =new Result();
- if (id==null) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出编号"));
- return res;
- }
- if (status!=0&&status!=2) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"审核状态"));
- return res;
- }
- if (remarks.length()>20) {
- res.getError().add(buildError("备注长度不能超过20个字符。"));
- return res;
- }
- res.setData(publicReleaseService.pushExaminePublicRelease( id , status, remarks,duration));
- return res;
- }
- /**
- * 外出审核日志列表
- * @return
- */
- @RequestMapping(value = "/listPublicReleaseLog", method = RequestMethod.GET)
- public Result listPublicReleaseLog(Integer id,String ufid){
- Result res =new Result();
- res.data(publicReleaseService.listPublicReleaseLog(id,ufid));
- return res;
- }
- /**
- * 公出统计
- * @return
- */
- @RequestMapping(value = "/publicReleaseStatistics", method = RequestMethod.GET)
- public Result publicReleaseStatistics(InputPublicStatistics in){
- Result res =new Result();
- res.data(publicReleaseService.publicReleaseStatistics(in));
- return res;
- }
- /**
- * 公出统计导出
- * @return
- */
- @RequestMapping(value = "/publicReleaseStatistics/export", method = RequestMethod.GET)
- public Result publicReleaseStatisticsExport(InputPublicStatistics in,HttpServletResponse response){
- List<OutPublicStatistics> list =publicReleaseService.publicReleaseStatisticsList(in);
- NewExcelUtil<OutPublicStatistics>excel=new NewExcelUtil<>(OutPublicStatistics.class);
- return excel.exportExcel(list,"公出统计列表",response);
- }
- /**
- * 公出详情列表
- * @return
- */
- @RequestMapping(value = "/publicReleaseDtails", method = RequestMethod.GET)
- public Result publicReleaseListDtails(InputPublicDtails in){
- Result res =new Result();
- res.data(publicReleaseService.publicReleaseListDtails(in));
- return res;
- }
- /**
- * 公出详情列表
- * @return
- */
- @RequestMapping(value = "/publicReleaseDtails/export", method = RequestMethod.GET)
- public Result publicReleaseListDtailsExport(InputPublicDtails in ){
- List<OutPublicDtails> list=publicReleaseService.publicReleaseListDtailsList(in);
- NewExcelUtil<OutPublicDtails>excel=new NewExcelUtil<>(OutPublicDtails.class);
- return excel.exportExcel(list,"公出详细列表",uploadPath);
- }
- /** 上传图片 **/
- @RequestMapping(value = "/upload", method = RequestMethod.POST)
- public Result uploadOrderInvoiceFile(HttpServletRequest req){
- Result res = new Result();
- res.setData(handleFile(res, "/publicRelease/", false, req, "publicRelease"));
- return res;
- }
- /**
- * 搜索
- * @return
- */
- @RequestMapping(value = "/addSupplement", method = RequestMethod.POST)
- public Result addSupplement(Integer id,String supplement,String nextPlan){
- Result res =new Result();
- if (id==null) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"公出编号"));
- return res;
- }
- if (supplement==null) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"本次公出目标总结"));
- return res;
- }
- if (nextPlan==null) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"下次公出计划"));
- return res;
- }
- res.setData(publicReleaseService.addSupplement( id ,supplement,nextPlan));
- return res;
- }
- /**
- * 根据客户返回订单
- */
- @RequestMapping(value = "/selectOrderByUid",method =RequestMethod.GET)
- public Result selectOrderByUid(String uid){
- Result res = new Result();
- if (uid==null){
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,ErrorConstants.PARAM_EMPTY_ERROR,"客户编号"));
- return res;
- }
- res.data(publicReleaseService.selectOrderByUid(uid));
- return res;
- }
- /**
- * 查看上门记录
- */
- @RequestMapping(value = "/publicByOrder",method =RequestMethod.GET)
- public Result publicByOrder(String orderNo){
- Result res = new Result();
- if (orderNo==null){
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,ErrorConstants.PARAM_EMPTY_ERROR,"订单编号"));
- return res;
- }
- res.data(publicReleaseService.publicByOrder(orderNo));
- return res;
- }
- }
|