| | |
| | | public static final String SIGN_IN_QRCODE_PREFIX ="SIGN_IN_QRCODE_PREFIX" ; |
| | | |
| | | |
| | | public static final String WEATHER_CONFIG ="WEATHER_CONFIG" ; |
| | | public static final String REQUEST_URL ="REQUEST_URL" ; |
| | | public static final String LOCATION ="LOCATION" ; |
| | | public static final String API_KEY ="API_KEY" ; |
| | | //被æè®¿äººä¿¡æ¯æ ¡éªæ¹å¼ï¼0ææºå·åç¬æ ¡éª 1ææºå·åå§åç»åæ ¡éªï¼ |
| | | public static final String BEVISITED_USER_VALID = "BEVISITED_USER_VALID"; |
| | | public static final String LW_BEVISITED_USER_VALID = "LW_BEVISITED_USER_VALID"; |
| | |
| | | public static final String FTP_USERNAME ="FTP_USERNAME" ; |
| | | public static final String FTP_PWD ="FTP_PWD" ; |
| | | public static final String COMPANY_DOCUMENTS ="COMPANY_DOCUMENTS" ; |
| | | public static final String APP_FILE ="APP_FILE" ; |
| | | |
| | | public static final String FTP_RESOURCE_PATH ="FTP_RESOURCE_PATH" ; |
| | | public static final String FTP_LOCAL_RESOURCE_PATH ="FTP_LOCAL_RESOURCE_PATH" ; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.core.utils; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * Created by IntelliJ IDEA. |
| | | * |
| | | * @Author : Rk |
| | | * @create 2025/10/10 11:31 |
| | | */ |
| | | @Slf4j |
| | | public class WeatherUtil { |
| | | |
| | | //APIå°åï¼ https://dev.qweather.com/docs/api/warning/weather-warning/ |
| | | private static final String apiPath = "/v7/warning/now"; |
| | | |
| | | public static String getWeatherWarningInfo(String apiUrl,String apiKey,String location){ |
| | | String url = apiUrl + apiPath + "?key=" + apiKey + "&location=" + location; |
| | | log.error(DateUtil.getCurrDateTime() + "天æ°è¯·æ±å°åï¼"+url); |
| | | String response = HttpsUtil.get(url,false); |
| | | log.error(DateUtil.getCurrDateTime() + "天æ°è¯·æ±è¿åï¼"+response); |
| | | return response; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "æ¯å¦æ¥è¯¢åºå®äººåï¼0=å¦ï¼1=æ¯" ) |
| | | @TableField(exist = false) |
| | | private Integer querySpecial; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦æ¥è¯¢é¥åææ ¡éªäººåï¼0=å¦ï¼1=æ¯" ) |
| | | @TableField(exist = false) |
| | | private Integer queryAuth; |
| | | |
| | | } |
| | |
| | | @PostMapping("/timer/platformJob/sendUnFinishNotice") |
| | | ApiResponse sendUnFinishNotice(); |
| | | |
| | | @ApiOperation("ãééæ°æ®ãéétoken宿¶å¨æ¥å£") |
| | | @PostMapping("/timer/dingTalkToken/updateDingTalkTokenOrigin") |
| | | ApiResponse updateDingTalkTokenOrigin() throws Exception; |
| | | |
| | | @ApiOperation("ã天æ°ä¿¡æ¯ã宿¶åæ¥å¤©æ°é¢è¦") |
| | | @PostMapping("/timer/weather/syncWeatherInfo") |
| | | ApiResponse syncWeatherInfo(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.HttpsUtil; |
| | | import com.doumee.core.wx.WXConstant; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.system.SystemDictDataService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.mgt.DefaultSecurityManager; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/11/30 15:33 |
| | | */ |
| | | @Api(tags = "éétoken宿¶å¨æ¥å£") |
| | | @RestController |
| | | @RequestMapping("/timer/dingTalkToken") |
| | | public class DingTalkTokenTimerController extends BaseController { |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | @Autowired |
| | | private SystemDictDataService systemDictDataService; |
| | | |
| | | @Autowired |
| | | private DingTalk dingTalk; |
| | | /** |
| | | * æ¯å¦å¼åè
|
| | | */ |
| | | @Value("${debug_model}") |
| | | private Boolean timing; |
| | | |
| | | @ApiOperation("å¼å¯å®æ¶æ´æ°ééä¸å¡token") |
| | | @PostMapping("/updateDingTalkTokenOrigin") |
| | | public ApiResponse updateDingTalkTokenOrigin() throws Exception { |
| | | dingTalk.updTokenInfo(); |
| | | return ApiResponse.success("å¼å¯å®æ¶æ´æ°å¾®ä¿¡å
¬ä¼å·accesstokenæå"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | import com.doumee.service.business.WarningService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.system.SystemDictDataService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/11/30 15:33 |
| | | */ |
| | | @Api(tags = "天æ°é¢è¦åæ¥") |
| | | @RestController |
| | | @RequestMapping("/timer/weather") |
| | | public class WeatherTimerController extends BaseController { |
| | | @Autowired |
| | | private WarningService warningService; |
| | | |
| | | /** |
| | | * æ¯å¦å¼åè
|
| | | */ |
| | | @Value("${debug_model}") |
| | | private Boolean timing; |
| | | |
| | | @ApiOperation("宿¶åæ¥å¤©æ°é¢è¦ä¿¡æ¯") |
| | | @PostMapping("/syncWeatherInfo") |
| | | public ApiResponse syncWeatherInfo(){ |
| | | warningService.getWeatherInfo(); |
| | | return ApiResponse.success("宿¶åæ¥å¤©æ°é¢è¦ä¿¡æ¯"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.JkCabinetGrid; |
| | | import com.doumee.dao.business.model.JkIccard; |
| | | import com.doumee.service.business.JkCabinetGridService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:update") |
| | | public ApiResponse updateById(@RequestBody JkCabinetGrid jkCabinetGrid,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinetGrid.setLoginUserInfo(getLoginUser(token)); |
| | | jkCabinetGridService.updateById(jkCabinetGrid); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹ç¶æ") |
| | | @PostMapping("/updateStatusById") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:update") |
| | | public ApiResponse updateStatusById(@RequestBody JkCabinetGrid jkCabinetGrid, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinetGrid.setLoginUserInfo(this.getLoginUser(token)); |
| | | jkCabinetGridService.updateStatusById(jkCabinetGrid); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("è§£ç»é¥å") |
| | | @PostMapping("/unBindKeys") |
| | | @CloudRequiredPermission("business:jkcabinetgrid:update") |
| | | public ApiResponse unBindKeys(@RequestBody List<Integer> idList, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkCabinetGridService.unBindKeys(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkCabinetGridService.findById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:jkcabinetlog:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<JkCabinetLog> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(JkCabinetLog.class).export(jkCabinetLogService.findPage(pageWrap).getRecords(), "é¥åæå¼å
³é¨è®°å½", response); |
| | | ExcelExporter.build(JkCabinetLog.class).export(jkCabinetLogService.findPage(pageWrap).getRecords(), "é¥åæå¼å
³é¨è®°å½_"+System.currentTimeMillis(), response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.JkCabinet; |
| | | import com.doumee.dao.business.model.JkIccard; |
| | | import com.doumee.service.business.JkIccardService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:jkiccard:create") |
| | | public ApiResponse create(@RequestBody JkIccard jkIccard) { |
| | | public ApiResponse create(@RequestBody JkIccard jkIccard,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkIccard.setLoginUserInfo(getLoginUser(token)); |
| | | return ApiResponse.success(jkIccardService.create(jkIccard)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:jkiccard:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkIccardService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:jkiccard:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | 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) { |
| | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:jkiccard:update") |
| | | public ApiResponse updateById(@RequestBody JkIccard jkIccard) { |
| | | public ApiResponse updateById(@RequestBody JkIccard jkIccard,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkIccard.setLoginUserInfo(getLoginUser(token)); |
| | | jkIccardService.updateById(jkIccard); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹ç¶æ") |
| | | @PostMapping("/updateStatusById") |
| | | @CloudRequiredPermission("business:jkiccard:update") |
| | | public ApiResponse updateStatusById(@RequestBody JkIccard jkIccard, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkIccard.setLoginUserInfo(this.getLoginUser(token)); |
| | | jkIccardService.updateStatusById(jkIccard); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:jkiccard:query") |
| | | public ApiResponse<PageData<JkIccard>> findPage (@RequestBody PageWrap<JkIccard> pageWrap) { |
| | | public ApiResponse<PageData<JkIccard>> findPage (@RequestBody PageWrap<JkIccard> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkIccardService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:jkiccard:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<JkIccard> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<JkIccard> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(JkIccard.class).export(jkIccardService.findPage(pageWrap).getRecords(), "é¥åæICå¡ä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:jkiccard:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkIccardService.findById(id)); |
| | | } |
| | | } |
| | |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:jkversion:create") |
| | | public ApiResponse create(@RequestBody JkVersion jkVersion) { |
| | | public ApiResponse create(@RequestBody JkVersion jkVersion,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkVersion.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(jkVersionService.create(jkVersion)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:jkversion:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | public ApiResponse deleteById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkVersionService.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:jkversion:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | 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) { |
| | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:jkversion:update") |
| | | public ApiResponse updateById(@RequestBody JkVersion jkVersion) { |
| | | public ApiResponse updateById(@RequestBody JkVersion jkVersion,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | jkVersion.setLoginUserInfo(this.getLoginUser(token)); |
| | | jkVersionService.updateById(jkVersion); |
| | | return ApiResponse.success(null); |
| | | } |
| | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:jkversion:query") |
| | | public ApiResponse<PageData<JkVersion>> findPage (@RequestBody PageWrap<JkVersion> pageWrap) { |
| | | public ApiResponse<PageData<JkVersion>> findPage (@RequestBody PageWrap<JkVersion> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkVersionService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:jkversion:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<JkVersion> pageWrap, HttpServletResponse response) { |
| | | public void exportExcel (@RequestBody PageWrap<JkVersion> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(JkVersion.class).export(jkVersionService.findPage(pageWrap).getRecords(), "交æ§-é¥åæç»ç«¯çæ¬ä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:jkversion:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | return ApiResponse.success(jkVersionService.findById(id)); |
| | | } |
| | | } |
| | |
| | | * api å°å https://open.dingtalk.com/document/orgapp/asynchronous-sending-of-enterprise-session-messages |
| | | * @throws ApiException |
| | | */ |
| | | public void workInfoOANotice(Long agentId,String userIds,OapiMessageCorpconversationAsyncsendV2Request.Msg msg){ |
| | | public Boolean workInfoOANotice(Long agentId,String userIds,OapiMessageCorpconversationAsyncsendV2Request.Msg msg){ |
| | | try{ |
| | | DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"); |
| | | OapiMessageCorpconversationAsyncsendV2Request request = new OapiMessageCorpconversationAsyncsendV2Request(); |
| | |
| | | request.setMsg(msg); |
| | | OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(request, "60c2df248ca93d4eafb4a04a2330d3d3");//getToken()); |
| | | if(rsp.getErrcode().equals(Constants.DD_ERR_CODE)){ |
| | | |
| | | return true; |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),rsp.getMessage()); |
| | | } |
| | | }catch (ApiException apiException){ |
| | | |
| | | } |
| | | return false; |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.JkIccard; |
| | | import com.github.yulichang.base.mapper.MPJJoinMapper; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/09/28 09:01 |
| | | */ |
| | | public interface JkIccardMapper extends BaseMapper<JkIccard> { |
| | | public interface JkIccardMapper extends MPJJoinMapper<JkIccard> { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.JkVersion; |
| | | import com.github.yulichang.base.mapper.MPJJoinMapper; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/09/28 09:01 |
| | | */ |
| | | public interface JkVersionMapper extends BaseMapper<JkVersion> { |
| | | public interface JkVersionMapper extends MPJJoinMapper<JkVersion> { |
| | | |
| | | } |
| | |
| | | @ExcelColumn(name="è¿è¡ç¶æ") |
| | | private Integer workingStatus; |
| | | |
| | | @ApiModelProperty(value = "æ¿å·") |
| | | @ExcelColumn(name="æ¿å·") |
| | | private String boardCode; |
| | | |
| | | @ApiModelProperty(value = "ééå·") |
| | | @ExcelColumn(name="ééå·") |
| | | private String channelCode; |
| | | |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "ç»å®ç¶æ 0æªç»å®ï¼1å·²ç»å®", example = "1") |
| | | @TableField(exist = false) |
| | | private Integer bindStatus; |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.service.business.third.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | public class JkCabinetLog extends LoginUserModel { |
| | | |
| | | @ApiModelProperty(value = "主é®", example = "1") |
| | | @ExcelColumn(name="主é®") |
| | | @TableId(type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "å建人ç¼ç ", example = "1") |
| | | @ExcelColumn(name="å建人ç¼ç ") |
| | | private Integer creator; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @ExcelColumn(name="å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @ExcelColumn(name="å¼é¨æ¶é´",index = 0,dateFormat = "yyyy-MM-dd HH:mm:ss",width = 16) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createDate; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°äººç¼ç ", example = "1") |
| | | @ExcelColumn(name="æ´æ°äººç¼ç ") |
| | | private Integer editor; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | @ExcelColumn(name="æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date editDate; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦å é¤0å¦ 1æ¯", example = "1") |
| | | @ExcelColumn(name="æ¯å¦å é¤0å¦ 1æ¯") |
| | | private Integer isdeleted; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | @ExcelColumn(name="夿³¨") |
| | | private String info; |
| | | |
| | | @ApiModelProperty(value = "é¥åæç¼ç ï¼å
³èjk_cabinet)", example = "1") |
| | | @ExcelColumn(name="é¥åæç¼ç ï¼å
³èjk_cabinet)") |
| | | private Integer cabinetId; |
| | | |
| | | @ApiModelProperty(value = "é¥åææ ¼ç¼ç (å
³èjk_cabinet_grid)", example = "1") |
| | | @ExcelColumn(name="é¥åææ ¼ç¼ç (å
³èjk_cabinet_grid)") |
| | | private Integer gridId; |
| | | |
| | | @ApiModelProperty(value = "éªè¯æ¹å¼ 0å·è¸ 1å·å¡", example = "1") |
| | | @ExcelColumn(name="éªè¯æ¹å¼ 0å·è¸ 1å·å¡") |
| | | @ExcelColumn(name="æ ¡éªæ¹å¼",index = 2,width = 10,valueMapping = "0=人è¸;1=å·å¡;2=ç®¡çææ;") |
| | | private Integer authType; |
| | | |
| | | @ApiModelProperty(value = "车è¾ç¼ç ï¼å
³ècars)", example = "1") |
| | | @ExcelColumn(name="车è¾ç¼ç ï¼å
³ècars)") |
| | | private Integer carId; |
| | | |
| | | @ApiModelProperty(value = "é¥åç¼ç (å
³èjk_keys)", example = "1") |
| | | @ExcelColumn(name="é¥åç¼ç (å
³èjk_keys)") |
| | | private Integer keyId; |
| | | |
| | | @ApiModelProperty(value = "人åç¼ç ï¼å
³èmember)", example = "1") |
| | | @ExcelColumn(name="人åç¼ç ï¼å
³èmember)") |
| | | private Integer memberId; |
| | | |
| | | @ApiModelProperty(value = "é¥åä¿¡æ¯ï¼è½¦çå·-é¥åç¼ç ï¼") |
| | | @ExcelColumn(name="é¥åä¿¡æ¯ï¼è½¦çå·-é¥åç¼ç ï¼") |
| | | @ExcelColumn(name="é¥å",index = 5,width = 16) |
| | | private String keyInfo; |
| | | |
| | | @ApiModelProperty(value = "é¢åè§å 0é车 1éæ´¾è½¦å", example = "1") |
| | | @ExcelColumn(name="é¢åè§å 0é车 1éæ´¾è½¦å") |
| | | private Integer roleType; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ 0æå 1失败", example = "1") |
| | | @ExcelColumn(name="ç¶æ 0æå 1失败") |
| | | @ExcelColumn(name="ç¶æ",index = 6,width = 10,valueMapping = "0=æå;1=失败;") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "æä½äººé¨é¨", example = "1",hidden = true) |
| | | @TableField(exist = false) |
| | | private String companyName; |
| | | |
| | | @ApiModelProperty(value = "æä½äººåç§°", example = "1") |
| | | @ExcelColumn(name="æä½äºº",index = 1,width = 2) |
| | | @TableField(exist = false) |
| | | private String memberName; |
| | | |
| | | @ApiModelProperty(value = "é¥åæåç§°", example = "1") |
| | | @ExcelColumn(name="æå±é¥åæ",index = 3,width = 12) |
| | | @TableField(exist = false) |
| | | private String cabinetName; |
| | | |
| | | @ApiModelProperty(value = "ææ ¼ç¼å·", example = "1") |
| | | @ExcelColumn(name="ææ ¼ç¼å·",index = 4,width = 12) |
| | | @TableField(exist = false) |
| | | private String gridCode; |
| | | |
| | | @ApiModelProperty(value = "æ¥è¯¢å¼å§æ¶é´ yyyy-MM-dd ") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date startDate; |
| | | |
| | | @ApiModelProperty(value = "æ¥è¯¢ç»ææ¶é´ yyyy-MM-dd ") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date endDate; |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.service.business.third.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @ExcelColumn(name="é¥åæç¼ç ï¼å
³èjk_cabinet)") |
| | | private Integer cabinetId; |
| | | |
| | | @ApiModelProperty(value = "å
³è人åç±»åï¼0=叿ºï¼1=æ ¡éªäººå", example = "1") |
| | | @ExcelColumn(name="å
³è人åç±»åï¼0=叿ºï¼1=æ ¡éªäººå") |
| | | private Integer userType; |
| | | |
| | | @ApiModelProperty(value = "人ååç§°", example = "1") |
| | | @TableField(exist = false) |
| | | private String memberName; |
| | | |
| | | } |
| | |
| | | @ExcelColumn(name=" ç¶æ 0æªç»å® 1å¨ä½ 2ååº 3ç»´ä¿®ä¿å
»") |
| | | private Integer status; |
| | | |
| | | |
| | | @ApiModelProperty(value = "åæ¾ä½ç½®", example = "1") |
| | | @TableField(exist = false) |
| | | private String gridCode; |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.service.business.third.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @ExcelColumn(name="å¹³å°ç±»å 0Android 1IOS") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "æä»¶å¤§å° åä½ï¼KBï¼", example = "1") |
| | | @ExcelColumn(name="æä»¶å¤§å° åä½ï¼KBï¼") |
| | | private Integer fileSize; |
| | | |
| | | @ApiModelProperty(value = "æä»¶å¤§å° åä½ï¼MBï¼", example = "1") |
| | | @TableField(exist = false) |
| | | private double fileSizeMb; |
| | | |
| | | |
| | | @ApiModelProperty(value = "å建人åç§°", example = "1") |
| | | @TableField(exist = false) |
| | | private String createUserName; |
| | | |
| | | @ApiModelProperty(value = "apkå
¨è·¯å¾", example = "1") |
| | | @TableField(exist = false) |
| | | private String fullFileUrl; |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | long count(JkCabinetGrid jkCabinetGrid); |
| | | |
| | | /** |
| | | * ç»å®é¥å |
| | | * @param jkCabinetGrid |
| | | */ |
| | | void bindingKeys(JkCabinetGrid jkCabinetGrid); |
| | | void updateStatusById(JkCabinetGrid jkCabinetGrid); |
| | | |
| | | void unBindKeys(List<Integer> idList); |
| | | } |
| | |
| | | * @return long |
| | | */ |
| | | long count(JkIccard jkIccard); |
| | | |
| | | void updateStatusById(JkIccard jkIccard); |
| | | } |
| | |
| | | long count(Warning warning); |
| | | |
| | | void updateStatus(Warning param); |
| | | |
| | | void getWeatherInfo(); |
| | | } |
| | |
| | | import com.doumee.dao.business.model.Cars; |
| | | import com.doumee.dao.business.model.JkCabinet; |
| | | import com.doumee.dao.business.model.JkKeys; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.JkCabinetGridMapper; |
| | |
| | | |
| | | @Override |
| | | public void updateById(JkCabinetGrid jkCabinetGrid) { |
| | | jkCabinetGridMapper.updateById(jkCabinetGrid); |
| | | if(Objects.isNull(jkCabinetGrid) |
| | | || Objects.isNull(jkCabinetGrid.getId()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = jkCabinetGrid.getLoginUserInfo(); |
| | | JkCabinetGrid model = jkCabinetGridMapper.selectById(jkCabinetGrid.getId()); |
| | | if(Objects.isNull(model)|| Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(Objects.nonNull(jkCabinetGrid.getKeyId())){ |
| | | if(Objects.nonNull(model.getKeyId())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å·²ç»å®ï¼è¯·å¿éå¤ç»å®"); |
| | | } |
| | | JkKeys keysModel = jkKeysMapper.selectById(jkCabinetGrid.getKeyId()); |
| | | if(Objects.isNull(keysModel)|| Constants.equalsInteger(keysModel.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(keysModel.getStatus(), (Constants.ZERO))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"é¥å已被ç»å®ï¼è¯·éæ©å
¶ä»é¥åç»å®"); |
| | | } |
| | | //æ´æ°é¥åæä¿¡æ¯ |
| | | jkCabinetGridMapper.update(new UpdateWrapper<JkCabinetGrid>().lambda() |
| | | .set(JkCabinetGrid::getKeyId,jkCabinetGrid.getKeyId()) |
| | | .set(JkCabinetGrid::getEditor,loginUserInfo.getId()) |
| | | .set(JkCabinetGrid::getEditDate,DateUtil.getCurrDateTime()) |
| | | .set(JkCabinetGrid::getEditDate, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinetGrid::getId,jkCabinetGrid.getId())); |
| | | //æ è®°é¥åä¿¡æ¯ |
| | | jkKeysMapper.update(new UpdateWrapper<JkKeys>().lambda() |
| | | .set(JkKeys::getStatus,Constants.ONE) |
| | | .eq(JkKeys::getId,jkCabinetGrid.getKeyId()) |
| | | ); |
| | | return; |
| | | }else if(Objects.nonNull(jkCabinetGrid.getChannelCode())||Objects.nonNull(jkCabinetGrid.getBoardCode())){ |
| | | jkCabinetGridMapper.update(new UpdateWrapper<JkCabinetGrid>().lambda() |
| | | .set(Objects.nonNull(jkCabinetGrid.getChannelCode()),JkCabinetGrid::getChannelCode,jkCabinetGrid.getChannelCode()) |
| | | .set(Objects.nonNull(jkCabinetGrid.getBoardCode()),JkCabinetGrid::getBoardCode,jkCabinetGrid.getBoardCode()) |
| | | .set(JkCabinetGrid::getEditDate, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinetGrid::getId,jkCabinetGrid.getId())); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void bindingKeys(JkCabinetGrid jkCabinetGrid){ |
| | | public void updateStatusById(JkCabinetGrid jkCabinetGrid) { |
| | | if(Objects.isNull(jkCabinetGrid) |
| | | || Objects.isNull(jkCabinetGrid.getId()) |
| | | || Objects.isNull(jkCabinetGrid.getKeyId())){ |
| | | || Objects.isNull(jkCabinetGrid.getId()) |
| | | || Objects.isNull(jkCabinetGrid.getStatus())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | JkCabinetGrid model = jkCabinetGridMapper.selectById(jkCabinetGrid.getId()); |
| | | if(Objects.isNull(model)|| Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(Objects.nonNull(model.getKeyId())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å·²ç»å®ï¼è¯·å¿éå¤ç»å®"); |
| | | } |
| | | JkKeys keysModel = jkKeysMapper.selectById(jkCabinetGrid.getKeyId()); |
| | | if(Objects.isNull(keysModel)|| Constants.equalsInteger(keysModel.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(keysModel.getStatus(), (Constants.ZERO))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"é¥å已被ç»å®ï¼è¯·éæ©å
¶ä»é¥åç»å®"); |
| | | } |
| | | //æ´æ°é¥åæä¿¡æ¯ |
| | | jkCabinetGridMapper.update(new UpdateWrapper<JkCabinetGrid>().lambda() |
| | | .set(JkCabinetGrid::getKeyId,jkCabinetGrid.getKeyId()) |
| | | jkCabinetGridMapper.update(null,new UpdateWrapper<JkCabinetGrid>() |
| | | .lambda().set(JkCabinetGrid::getStatus,jkCabinetGrid.getStatus()) |
| | | .set(JkCabinetGrid::getEditDate, DateUtil.getCurrDateTime()) |
| | | .eq(JkCabinetGrid::getId,jkCabinetGrid.getId())); |
| | | //æ è®°é¥åä¿¡æ¯ |
| | | jkKeysMapper.update(new UpdateWrapper<JkKeys>().lambda() |
| | | .set(JkKeys::getStatus,Constants.ONE) |
| | | .eq(JkKeys::getId,jkCabinetGrid.getKeyId()) |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.JkCabinetLogMapper; |
| | | import com.doumee.dao.business.model.JkCabinetLog; |
| | | import com.doumee.service.business.JkCabinetLogService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * é¥åæå¼å
³é¨è®°å½Serviceå®ç° |
| | |
| | | @Override |
| | | public PageData<JkCabinetLog> findPage(PageWrap<JkCabinetLog> pageWrap) { |
| | | IPage<JkCabinetLog> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<JkCabinetLog> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | JkCabinetLog model = pageWrap.getModel(); |
| | | |
| | | |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(JkCabinetLog::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(JkCabinetLog::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(JkCabinetLog::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(JkCabinetLog::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getInfo() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getInfo, pageWrap.getModel().getInfo()); |
| | | } |
| | | if (pageWrap.getModel().getCabinetId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getCabinetId, pageWrap.getModel().getCabinetId()); |
| | | } |
| | | if (pageWrap.getModel().getGridId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getGridId, pageWrap.getModel().getGridId()); |
| | | } |
| | | if (pageWrap.getModel().getAuthType() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getAuthType, pageWrap.getModel().getAuthType()); |
| | | } |
| | | if (pageWrap.getModel().getCarId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getCarId, pageWrap.getModel().getCarId()); |
| | | } |
| | | if (pageWrap.getModel().getKeyId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getKeyId, pageWrap.getModel().getKeyId()); |
| | | } |
| | | if (pageWrap.getModel().getMemberId() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getMemberId, pageWrap.getModel().getMemberId()); |
| | | } |
| | | if (pageWrap.getModel().getKeyInfo() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getKeyInfo, pageWrap.getModel().getKeyInfo()); |
| | | } |
| | | if (pageWrap.getModel().getRoleType() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getRoleType, pageWrap.getModel().getRoleType()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(JkCabinetLog::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | MPJLambdaWrapper<JkCabinetLog> wrapper = new MPJLambdaWrapper<JkCabinetLog>() |
| | | .selectAll(JkCabinetLog.class) |
| | | .selectAs(Member::getName,JkCabinetLog::getMemberName) |
| | | .selectAs(Company::getName,JkCabinetLog::getCompanyName) |
| | | .selectAs(JkCabinet::getName,JkCabinetLog::getCabinetName) |
| | | .selectAs(JkCabinetGrid::getCode,JkCabinetLog::getGridCode) |
| | | .leftJoin(JkCabinet.class,JkCabinet::getId,JkCabinetLog::getCabinetId) |
| | | .leftJoin(JkCabinetGrid.class,JkCabinetGrid::getId,JkCabinetLog::getGridId) |
| | | .leftJoin(Member.class,Member::getId,JkCabinetLog::getMemberId) |
| | | .leftJoin(Company.class,Company::getId,Member::getCompanyId) |
| | | .ge(Objects.nonNull(model.getStartDate()),JkCabinetLog::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getStartDate())) |
| | | .le(Objects.nonNull(model.getEndDate()),JkCabinetLog::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getEndDate())) |
| | | .like(StringUtils.isNotBlank(model.getMemberName()),Member::getName,model.getMemberName()) |
| | | .eq(Objects.nonNull(model.getCabinetId()),JkCabinetLog::getCabinetId,model.getCabinetId()) |
| | | .eq(Objects.nonNull(model.getKeyId()),JkCabinetLog::getKeyId,model.getKeyId()) |
| | | .eq(Objects.nonNull(model.getAuthType()),JkCabinetLog::getAuthType,model.getAuthType()) |
| | | .eq(Objects.nonNull(model.getStatus()),JkCabinetLog::getStatus,model.getStatus()) |
| | | .eq(JkCabinetLog::getIsdeleted, Constants.ZERO) |
| | | .orderByDesc(JkCabinetLog::getCreateDate); |
| | | IPage<JkCabinetLog> iPage = jkCabinetLogMapper.selectJoinPage(page,JkCabinetLog.class,wrapper); |
| | | for (JkCabinetLog jkCabinetLog:iPage.getRecords()) { |
| | | if(StringUtils.isNotBlank(jkCabinetLog.getCompanyName())&&StringUtils.isNotBlank(jkCabinetLog.getMemberName())){ |
| | | jkCabinetLog.setMemberName(jkCabinetLog.getMemberName() + " - " + jkCabinetLog.getCompanyName() ); |
| | | } |
| | | } |
| | | return PageData.from(jkCabinetLogMapper.selectPage(page, queryWrapper)); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * é¥åæICå¡ä¿¡æ¯è¡¨Serviceå®ç° |
| | |
| | | |
| | | @Override |
| | | public Integer create(JkIccard jkIccard) { |
| | | if(Objects.isNull(jkIccard) |
| | | || StringUtils.isBlank(jkIccard.getCode()) |
| | | || Objects.isNull(jkIccard.getStatus()) |
| | | || Objects.isNull(jkIccard.getMemberId()) |
| | | || Objects.isNull(jkIccard.getUserType()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | |
| | | LoginUserInfo loginUserInfo = jkIccard.getLoginUserInfo(); |
| | | jkIccard.setCreateDate(new Date()); |
| | | jkIccard.setCreator(loginUserInfo.getId()); |
| | | jkIccard.setEditDate(jkIccard.getCreateDate()); |
| | | jkIccard.setEditor(jkIccard.getCreator()); |
| | | jkIccard.setIsdeleted(Constants.ZERO); |
| | | //æ¥è¯¢ç¼å·æ¯å¦éå¤ |
| | | if(jkIccardMapper.selectCount(new QueryWrapper<JkIccard>().lambda().eq(JkIccard::getCode,jkIccard.getCode()).eq(JkIccard::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ICå¡å·å·²åå¨ï¼"); |
| | | } |
| | | jkIccardMapper.insert(jkIccard); |
| | | return jkIccard.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | jkIccardMapper.deleteById(id); |
| | | JkIccard jkIccard = jkIccardMapper.selectById(id); |
| | | if(Objects.isNull(jkIccard)||Constants.equalsInteger(jkIccard.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(Constants.equalsInteger(jkIccard.getStatus(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å¯ç¨æ°æ®æ æ³è¿è¡å é¤ï¼"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void updateById(JkIccard jkIccard) { |
| | | if(Objects.isNull(jkIccard) |
| | | || Objects.isNull(jkIccard.getId()) |
| | | || StringUtils.isBlank(jkIccard.getCode()) |
| | | || Objects.isNull(jkIccard.getStatus()) |
| | | || Objects.isNull(jkIccard.getMemberId()) |
| | | || Objects.isNull(jkIccard.getUserType()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | LoginUserInfo loginUserInfo = jkIccard.getLoginUserInfo(); |
| | | jkIccard.setCreateDate(new Date()); |
| | | jkIccard.setCreator(loginUserInfo.getId()); |
| | | jkIccard.setEditDate(jkIccard.getCreateDate()); |
| | | jkIccard.setEditor(jkIccard.getCreator()); |
| | | jkIccard.setIsdeleted(Constants.ZERO); |
| | | //æ¥è¯¢ç¼å·æ¯å¦éå¤ |
| | | if(jkIccardMapper.selectCount(new QueryWrapper<JkIccard>().lambda().ne(JkIccard::getId,jkIccard.getId()).eq(JkIccard::getCode,jkIccard.getCode()).eq(JkIccard::getIsdeleted,Constants.ZERO))>Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ICå¡å·å·²åå¨ï¼"); |
| | | } |
| | | jkIccardMapper.updateById(jkIccard); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public PageData<JkIccard> findPage(PageWrap<JkIccard> pageWrap) { |
| | | IPage<JkIccard> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<JkIccard> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(JkIccard::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(JkIccard::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(JkIccard::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(JkIccard::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getInfo() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getInfo, pageWrap.getModel().getInfo()); |
| | | } |
| | | if (pageWrap.getModel().getMemberId() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getMemberId, pageWrap.getModel().getMemberId()); |
| | | } |
| | | if (pageWrap.getModel().getCode() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getCode, pageWrap.getModel().getCode()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getCabinetId() != null) { |
| | | queryWrapper.lambda().eq(JkIccard::getCabinetId, pageWrap.getModel().getCabinetId()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(jkIccardMapper.selectPage(page, queryWrapper)); |
| | | JkIccard model = pageWrap.getModel(); |
| | | MPJLambdaWrapper<JkIccard> wrapper = new MPJLambdaWrapper<JkIccard>() |
| | | .selectAll(JkIccard.class) |
| | | .selectAs(Member::getName,JkIccard::getMemberName) |
| | | .leftJoin(Member.class,Member::getId,JkIccard::getMemberId) |
| | | .eq(JkIccard::getIsdeleted,Constants.ZERO) |
| | | .eq(Objects.nonNull(model.getStatus()),JkIccard::getStatus,model.getStatus()) |
| | | .like(StringUtils.isNotBlank(model.getCode()),JkIccard::getCode,model.getCode()) |
| | | .like(StringUtils.isNotBlank(model.getMemberName()),Member::getName,model.getMemberName()) |
| | | .orderByDesc(JkIccard::getCreateDate) |
| | | ; |
| | | IPage<JkIccard> iPage = jkIccardMapper.selectJoinPage(page,JkIccard.class,wrapper); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |
| | |
| | | QueryWrapper<JkIccard> wrapper = new QueryWrapper<>(jkIccard); |
| | | return jkIccardMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void updateStatusById(JkIccard jkIccard) { |
| | | if(Objects.isNull(jkIccard) |
| | | || Objects.isNull(jkIccard.getId()) |
| | | || Objects.isNull(jkIccard.getStatus())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | jkIccardMapper.update(null,new UpdateWrapper<JkIccard>() |
| | | .lambda().set(JkIccard::getStatus,jkIccard.getStatus()) |
| | | .set(JkIccard::getEditDate, DateUtil.getCurrDateTime()) |
| | | .eq(JkIccard::getId,jkIccard.getId())); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | jkKeys.setEditor(loginUserInfo.getId()); |
| | | jkKeys.setIsdeleted(Constants.ZERO); |
| | | jkKeys.setStatus(Constants.ZERO); |
| | | jkKeys.setCarCode(cars.getCode()); |
| | | jkKeysMapper.insert(jkKeys); |
| | | return jkKeys.getId(); |
| | | } |
| | |
| | | LoginUserInfo loginUserInfo = jkKeys.getLoginUserInfo(); |
| | | jkKeys.setEditDate(new Date()); |
| | | jkKeys.setEditor(loginUserInfo.getId()); |
| | | jkKeys.setCarCode(cars.getCode()); |
| | | jkKeysMapper.updateById(jkKeys); |
| | | } |
| | | |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.model.JkCabinet; |
| | | import com.doumee.dao.business.model.JkCabinetLog; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import lombok.extern.java.Log; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 交æ§-é¥åæç»ç«¯çæ¬ä¿¡æ¯è¡¨Serviceå®ç° |
| | |
| | | @Autowired |
| | | private JkVersionMapper jkVersionMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | |
| | | @Override |
| | | public Integer create(JkVersion jkVersion) { |
| | | if(Objects.isNull(jkVersion) |
| | | || Objects.isNull(jkVersion.getType()) |
| | | || Objects.isNull(jkVersion.getIsForce()) |
| | | || StringUtils.isBlank(jkVersion.getVersionInfo()) |
| | | || StringUtils.isBlank(jkVersion.getFileUrl()) |
| | | || Objects.isNull(jkVersion.getFileSize()) |
| | | || StringUtils.isBlank(jkVersion.getName()) |
| | | || StringUtils.isBlank(jkVersion.getContent()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | } |
| | | LoginUserInfo loginUserInfo = jkVersion.getLoginUserInfo(); |
| | | jkVersion.setCreateDate(new Date()); |
| | | jkVersion.setCreator(loginUserInfo.getId()); |
| | | jkVersion.setEditDate(jkVersion.getCreateDate()); |
| | | jkVersion.setEditor(jkVersion.getCreator()); |
| | | jkVersion.setIsdeleted(Constants.ZERO); |
| | | jkVersionMapper.insert(jkVersion); |
| | | return jkVersion.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id) { |
| | | jkVersionMapper.deleteById(id); |
| | | jkVersionMapper.update(null,new UpdateWrapper<JkVersion>().lambda() |
| | | .set(JkVersion::getIsdeleted,Constants.ONE) |
| | | .eq(JkVersion::getId,id)); |
| | | // jkVersionMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void updateById(JkVersion jkVersion) { |
| | | if(Objects.isNull(jkVersion) |
| | | || Objects.isNull(jkVersion.getId()) |
| | | || Objects.isNull(jkVersion.getType()) |
| | | || Objects.isNull(jkVersion.getIsForce()) |
| | | || StringUtils.isBlank(jkVersion.getVersionInfo()) |
| | | || StringUtils.isBlank(jkVersion.getFileUrl()) |
| | | || Objects.isNull(jkVersion.getFileSize()) |
| | | || StringUtils.isBlank(jkVersion.getName()) |
| | | || StringUtils.isBlank(jkVersion.getContent()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | } |
| | | LoginUserInfo loginUserInfo = jkVersion.getLoginUserInfo(); |
| | | jkVersion.setEditDate(new Date()); |
| | | jkVersion.setEditor(loginUserInfo.getId()); |
| | | jkVersionMapper.updateById(jkVersion); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public JkVersion findById(Integer id) { |
| | | return jkVersionMapper.selectById(id); |
| | | JkVersion jkVersion = jkVersionMapper.selectById(id); |
| | | if(Objects.nonNull(jkVersion)&&StringUtils.isNotBlank(jkVersion.getFileUrl())){ |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.APP_FILE).getCode(); |
| | | jkVersion.setFullFileUrl(path + jkVersion.getFileUrl()); |
| | | } |
| | | return jkVersion; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public PageData<JkVersion> findPage(PageWrap<JkVersion> pageWrap) { |
| | | IPage<JkVersion> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<JkVersion> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(JkVersion::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(JkVersion::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(JkVersion::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(JkVersion::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getInfo() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getInfo, pageWrap.getModel().getInfo()); |
| | | } |
| | | if (pageWrap.getModel().getVersionInfo() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getVersionInfo, pageWrap.getModel().getVersionInfo()); |
| | | } |
| | | if (pageWrap.getModel().getFileUrl() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getFileUrl, pageWrap.getModel().getFileUrl()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getContent() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getContent, pageWrap.getModel().getContent()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | if (pageWrap.getModel().getTitle() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getTitle, pageWrap.getModel().getTitle()); |
| | | } |
| | | if (pageWrap.getModel().getIsForce() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getIsForce, pageWrap.getModel().getIsForce()); |
| | | } |
| | | if (pageWrap.getModel().getType() != null) { |
| | | queryWrapper.lambda().eq(JkVersion::getType, pageWrap.getModel().getType()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | JkVersion model = pageWrap.getModel(); |
| | | MPJLambdaWrapper<JkVersion> wrapper = new MPJLambdaWrapper<JkVersion>() |
| | | .selectAll(JkVersion.class) |
| | | .selectAs(SystemUser::getRealname,JkVersion::getCreateUserName) |
| | | .select(" ROUND( t.file_size / 1024, 2) ", JkVersion::getFileSizeMb) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,JkVersion::getCreator) |
| | | .eq(JkVersion::getIsdeleted,Constants.ZERO) |
| | | .eq(Objects.nonNull(model.getIsForce()),JkVersion::getIsForce,model.getIsForce()) |
| | | .like(StringUtils.isNotBlank(model.getVersionInfo()),JkVersion::getVersionInfo,model.getVersionInfo()) |
| | | .orderByDesc(JkVersion::getVersionInfo,JkVersion::getCreateDate) |
| | | ; |
| | | IPage<JkVersion> iPage = jkVersionMapper.selectJoinPage(page,JkVersion.class,wrapper); |
| | | String path = systemDictDataBiz.queryByCode(Constants.FTP,Constants.FTP_LOCAL_RESOURCE_PATH).getCode() |
| | | +systemDictDataBiz.queryByCode(Constants.FTP,Constants.APP_FILE).getCode(); |
| | | for (JkVersion jkVersion:iPage.getRecords()) { |
| | | if(Objects.nonNull(jkVersion)&&StringUtils.isNotBlank(jkVersion.getFileUrl())){ |
| | | jkVersion.setFullFileUrl(path + jkVersion.getFileUrl()); |
| | | } |
| | | } |
| | | return PageData.from(jkVersionMapper.selectPage(page, queryWrapper)); |
| | | return PageData.from(iPage); |
| | | } |
| | | |
| | | @Override |
| | |
| | | private MemberJoinMapper memberJoinMapper; |
| | | |
| | | @Autowired |
| | | private JkCabinetMapper jkCabinetMapper; |
| | | |
| | | @Autowired |
| | | private TrainTimeMapper trainTimeMapper; |
| | | |
| | | @Autowired |
| | |
| | | queryWrapper.apply(" find_in_set('"+companySpecialId+"',REPLACE(t3.company_path,'/',',')) "); |
| | | } |
| | | } |
| | | if(null != member.getQueryAuth() && Constants.equalsInteger(member.getQueryAuth(),Constants.ONE)){ |
| | | List<JkCabinet> jkCabinets = jkCabinetMapper.selectList(new QueryWrapper<JkCabinet>().lambda() |
| | | .eq(JkCabinet::getIsdeleted,Constants.ZERO) |
| | | .isNotNull(JkCabinet::getAuthMemberId) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(jkCabinets)){ |
| | | List<String> memberIdList = new ArrayList<>(); |
| | | List<String> authMemberId = jkCabinets.stream().map(i->i.getAuthMemberId()).collect(Collectors.toList()); |
| | | for (String s:authMemberId) { |
| | | memberIdList.addAll(Arrays.asList(s.split(","))) ; |
| | | } |
| | | queryWrapper.in(Member::getId,memberIdList); |
| | | } |
| | | |
| | | } |
| | | queryWrapper.eq(Member::getIsdeleted,Constants.ZERO); |
| | | queryWrapper.eq(Member::getWorkStatus,Constants.ZERO); |
| | | queryWrapper.orderByAsc(Member::getPinyin); |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.dingTalk.DingTalk; |
| | | 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.PlatformGroup; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.WeatherUtil; |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.dao.MemberMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.WarningMapper; |
| | | import com.doumee.dao.business.model.Warning; |
| | | import com.doumee.service.business.WarningService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ¥è¦è®°å½ä¿¡æ¯è¡¨Serviceå®ç° |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/09/28 09:01 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class WarningServiceImpl implements WarningService { |
| | | |
| | | @Autowired |
| | | private WarningMapper warningMapper; |
| | | |
| | | @Autowired |
| | | private WarningRuleMapper warningRuleMapper; |
| | | |
| | | @Autowired |
| | | private WarningRuleDetailMapper warningRuleDetailMapper; |
| | | |
| | | @Autowired |
| | | private WarningPushMapper warningPushMapper; |
| | | |
| | | @Autowired |
| | | private WarningEventMapper warningEventMapper; |
| | | |
| | | @Autowired |
| | | private DingTalk dingTalk; |
| | | |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | |
| | | @Override |
| | | public Integer create(Warning warning) { |
| | |
| | | model.setEditor(param.getLoginUserInfo().getId()); |
| | | warningMapper.updateById(model); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 宿¶è·å天æ°ä¿¡æ¯æ§è¡ |
| | | */ |
| | | @Override |
| | | public void getWeatherInfo(){ |
| | | try{ |
| | | String response = WeatherUtil.getWeatherWarningInfo(systemDictDataBiz.queryByCode(Constants.WEATHER_CONFIG,Constants.REQUEST_URL).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.WEATHER_CONFIG,Constants.API_KEY).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.WEATHER_CONFIG,Constants.LOCATION).getCode()); |
| | | if(StringUtils.isBlank(response)){ |
| | | log.error("æ è¿åæ°æ®"); |
| | | } |
| | | JSONObject jsonObject = JSONObject.parseObject(response); |
| | | if(jsonObject.getString("code").equals("200")){ |
| | | if(jsonObject.containsKey("warning")){ |
| | | Warning warning = warningMapper.selectOne(new QueryWrapper<Warning>().lambda() |
| | | .eq(Warning::getType,Constants.FOUR).eq(Warning::getIsdeleted,Constants.ZERO).last("limt 1")); |
| | | if(Objects.isNull(warning)){ |
| | | return; |
| | | } |
| | | //æ¥è¯¢éç¥äººå |
| | | List<WarningRule> warningRuleList = warningRuleMapper.selectList(new QueryWrapper<WarningRule>().lambda() |
| | | .eq(WarningRule::getIsdeleted,Constants.ZERO) |
| | | .apply(" id in ( select w.RULE_ID from warning_rule_detail w where w.WARNING_ID = '"+warning.getId()+"' and w.ISDELETED = 0 ) ") |
| | | ); |
| | | List<Member> memberList = new ArrayList<>(); |
| | | if(org.apache.commons.collections.CollectionUtils.isNotEmpty(warningRuleList)){ |
| | | List<String> memberIdStr = warningRuleList.stream().map(i->i.getMemberIds()).collect(Collectors.toList()); |
| | | if(org.apache.commons.collections.CollectionUtils.isNotEmpty(memberIdStr)){ |
| | | List<String> memberIdList = new ArrayList<>(); |
| | | for (String s:memberIdStr) { |
| | | memberIdList.addAll( |
| | | Arrays.asList(s.split(",")) |
| | | ); |
| | | } |
| | | memberList = memberMapper.selectList(new QueryWrapper<Member>().lambda().eq(Member::getIsdeleted,Constants.ZERO) |
| | | .notIn(Member::getErpId) |
| | | .in(Member::getId,memberIdList) |
| | | ); |
| | | } |
| | | } |
| | | JSONArray jsonArray = jsonObject.getJSONArray("warning"); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | List<WarningPush> warningPushList = new ArrayList<>(); |
| | | JSONObject weatherInfo = jsonArray.getJSONObject(i); |
| | | String code = weatherInfo.getString("id"); |
| | | String title = weatherInfo.getString("title"); |
| | | String text = weatherInfo.getString("text"); |
| | | //åå¨é¢è¦ ååå¨é¢è¦ä¿¡æ¯ |
| | | if(warningEventMapper.selectCount(new QueryWrapper<WarningEvent>() |
| | | .lambda() |
| | | .eq(WarningEvent::getEventId,code) |
| | | )>Constants.ZERO){ |
| | | continue; |
| | | } |
| | | |
| | | WarningEvent warningEvent = new WarningEvent(); |
| | | warningEvent.setCreateDate(new Date()); |
| | | warningEvent.setIsdeleted(Constants.ZERO); |
| | | warningEvent.setWarningId(warning.getId()); |
| | | warningEvent.setTitle(title); |
| | | warningEvent.setContent(text); |
| | | warningEvent.setEventId(code); |
| | | warningEvent.setHappenTime(DateUtil.getCurrDateTime()); |
| | | warningEvent.setJsonContent(weatherInfo.toJSONString()); |
| | | warningEventMapper.insert(warningEvent); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(memberList)&&memberList.size()>Constants.ZERO){ |
| | | List<String> ddUserIdList = memberList.stream().map(j->j.getErpId()).collect(Collectors.toList()); |
| | | //å鿍éééæ¶æ¯ |
| | | Boolean isSuccess = dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()), |
| | | String.join(",",ddUserIdList), |
| | | dingTalk.getWeatherNoticeMsg(title,text)); |
| | | for (Member member:memberList) { |
| | | WarningPush warningPush = new WarningPush(); |
| | | warningPush.setCreateDate(new Date()); |
| | | warningPush.setWarningId(warning.getId()); |
| | | warningPush.setTitle(warningEvent.getTitle()); |
| | | warningPush.setContent(warningEvent.getContent()); |
| | | warningPush.setStatus(isSuccess?Constants.ONE:Constants.TWO); |
| | | warningPush.setPushType(Constants.ZERO); |
| | | warningPush.setMemberId(member.getId()); |
| | | warningPushList.add(warningPush); |
| | | } |
| | | } |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(warningPushList)){ |
| | | warningPushMapper.insert(warningPushList); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |