| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.dao.business.model.JkCustomer; |
| | | import com.doumee.dao.business.model.JkSketch; |
| | | import com.doumee.dao.business.model.JkSketchLine; |
| | | import com.doumee.service.business.JkSketchService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/09/28 09:01 |
| | | */ |
| | | @Api(tags = "交æ§-线路ä¼åè®°å½ä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/jkSketch") |
| | | public class JkSketchCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private JkSketchService jkSketchService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:jksketch:create") |
| | | public ApiResponse create(@RequestBody JkSketch jkSketch, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkSketchService.create(jkSketch)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:jksketch:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkSketchService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:jksketch:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | jkSketchService.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:jksketch:update") |
| | | public ApiResponse updateById(@RequestBody JkSketch jkSketch, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkSketch.setLoginUserInfo(this.getLoginUser(token)); |
| | | JkSketch model = jkSketchService.updateById(jkSketch); |
| | | jkSketchService.startUpdateLineAsync(model);//弿¥ä¼å |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateSketchLine") |
| | | @CloudRequiredPermission("business:jksketch:update") |
| | | public ApiResponse updateSketchLine(@RequestBody JkSketch jkSketch, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkSketch.setLoginUserInfo(this.getLoginUser(token)); |
| | | JkSketch model = jkSketchService.updateSketchLine(jkSketch); |
| | | jkSketchService.startEditSketchLineAsync(model);//弿¥ä¼å |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDéæ°è®¡ç®å½å线路çè·ç¦»") |
| | | @PostMapping("/initOriginDistance") |
| | | @CloudRequiredPermission("business:jksketch:update") |
| | | public ApiResponse<JkSketch> initOriginDistance(@RequestBody JkSketch jkSketch, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkSketch.setLoginUserInfo(this.getLoginUser(token)); |
| | | JkSketch model = jkSketchService.initOriginDistance(jkSketch); |
| | | return ApiResponse.success(model); |
| | | } |
| | | @ApiOperation("主线路客æ·è·ç¦»è®¡ç®") |
| | | @PostMapping("/distanceCustomer") |
| | | @CloudRequiredPermission("business:jksketch:update") |
| | | public ApiResponse distanceCustomer(@RequestBody JkSketch model, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | model.setLoginUserInfo(this.getLoginUser(token)); |
| | | Category category = jkSketchService.checkDataValid(model); |
| | | jkSketchService.distanceCustomer(category);//弿¥è®¡ç® |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:jksketch:query") |
| | | public ApiResponse<PageData<JkSketch>> findPage (@RequestBody PageWrap<JkSketch> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkSketchService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:jksketch:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<JkSketch> pageWrap, HttpServletResponse response, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(JkSketch.class).export(jkSketchService.findPage(pageWrap).getRecords(), "交æ§-线路ä¼åè®°å½ä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:jksketch:query") |
| | | public ApiResponse findById(@PathVariable Integer id, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkSketchService.findById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "订åä¿¡æ¯å¯¼å
¥" ,notes = "订åä¿¡æ¯å¯¼å
¥") |
| | | @PostMapping("/importExcel") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), |
| | | @ApiImplicitParam(name = "dateInfo", value = "dateInfo", required = true, paramType = "query", dataType = "String" ), |
| | | }) |
| | | @CloudRequiredPermission("business:jksketch:create") |
| | | public ApiResponse<String> importExcel (@ApiParam(value = "file") MultipartFile file, String dateInfo, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | List<JkSketch> list = jkSketchService.importBatch(file,dateInfo,this.getLoginUser(token)); |
| | | if(list!=null){ |
| | | for(JkSketch model :list){ |
| | | jkSketchService.startInitOriginDistanceBatch(model); |
| | | } |
| | | } |
| | | return ApiResponse.success("导å
¥æå"); |
| | | } |
| | | } |