| | |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <mainClass>com.qianwen.smartman.Application</mainClass> |
| | | <layout>ZIP</layout> |
| | | <includes> |
| | | |
| | | <include> |
| | | <groupId>nothing</groupId> |
| | | <artifactId>nothing</artifactId> |
| | | </include> |
| | | |
| | | </includes> |
| | | </configuration> |
| | | </plugin> |
| | | <plugin> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * èååç±» |
| | | */ |
| | | public enum MenuCategoryEnum { |
| | | APP(0, "app"), |
| | | MENU(1, "èå"), |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.qianwen.core.log.annotation.ApiLog; |
| | | import com.qianwen.core.mp.support.Condition; |
| | | import com.qianwen.core.mp.support.Query; |
| | | import com.qianwen.core.scanner.modular.annotation.GetResource; |
| | | import com.qianwen.core.scanner.modular.annotation.PostResource; |
| | | import com.qianwen.core.scanner.modular.stereotype.ApiResource; |
| | | import com.qianwen.core.secure.annotation.PreAuth; |
| | | import com.qianwen.core.tenant.annotation.NonDS; |
| | | import com.qianwen.core.tool.api.R; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectTemplate; |
| | | import com.qianwen.smartman.modules.cps.service.CollectDeviceTypeService; |
| | | import com.qianwen.smartman.modules.cps.service.CollectTemplateService; |
| | | import com.qianwen.smartman.modules.cps.vo.CollectDeviceTypeVO; |
| | | import com.qianwen.smartman.modules.cps.vo.CollectTemplateVO; |
| | | import com.qianwen.smartman.modules.cps.wrapper.CollectTemplateWrapper; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | @Api(value = "é鿍¡æ¿", tags = {"é鿍¡æ¿"}) |
| | | @RestController |
| | | @ApiResource({"smart-collect/tpl"}) |
| | | @NonDS |
| | | public class CollectTemplateController { |
| | | @Autowired |
| | | private CollectTemplateService templateService; |
| | | |
| | | @Autowired |
| | | private CollectDeviceTypeService collectDeviceTypeService; |
| | | |
| | | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiLog("设å¤ééç±»åå表") |
| | | @GetResource({"/typelist"}) |
| | | @ApiOperation(value = "设å¤ééç±»åå表") |
| | | public R<List<CollectDeviceTypeVO>> list() { |
| | | |
| | | return R.data(collectDeviceTypeService.typeList()); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiLog("é鿍¡æ¿è¯¦æ
") |
| | | @ApiOperation(value = "é鿍¡æ¿è¯¦æ
", notes = "ä¼ å
¥id") |
| | | @GetResource({"/detail"}) |
| | | public R<CollectTemplateVO> detail(Long id) { |
| | | return R.data(this.templateService.detail(id)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiImplicitParams({@ApiImplicitParam(name = "name", value = "åç§°", paramType = "query", dataType = "string")}) |
| | | @ApiLog("æ¥è¯¢é鿍¡æ¿å表") |
| | | @GetResource({"/page"}) |
| | | @ApiOperation(value = "模æ¿å表", notes = "ä¼ å
¥name,type") |
| | | public R<IPage<CollectTemplateVO>> page(@ApiIgnore CollectTemplate tpl, Query query) { |
| | | IPage<CollectTemplate> pages = this.templateService.selectPage(Condition.getPage(query), tpl); |
| | | |
| | | //return R.data(UserWrapper.build().pageVO(pages)); |
| | | return R.data(CollectTemplateWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @PostResource({"/submit"}) |
| | | @ApiLog("æ°å¢æä¿®æ¹é鿍¡æ¿") |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹", notes = "ä¼ å
¥æ¨¡æ¿") |
| | | @PreAuth |
| | | public R<Void> submit(@Valid @RequestBody CollectTemplateVO tpl) { |
| | | this.templateService.submit(tpl); |
| | | return R.status(true); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 6) |
| | | @PostResource({"/remove"}) |
| | | @ApiLog("å 餿¨¡æ¿") |
| | | @ApiOperation(value = "å é¤", notes = "ä¼ å
¥idéå") |
| | | @PreAuth |
| | | public R<Boolean> remove(@RequestParam String ids) { |
| | | |
| | | return R.status(templateService.removeTemplate(ids)); |
| | | } |
| | | /* |
| | | @ApiOperationSupport(order = RegionCache.VILLAGE_LEVEL) |
| | | @PostResource({"/update"}) |
| | | @ApiLog("ä¿®æ¹ç¨æ·") |
| | | @ApiOperation(value = "ä¿®æ¹", notes = "ä¼ å
¥User") |
| | | @PreAuth |
| | | public R update(@Valid @RequestBody User user) { |
| | | CacheUtil.clear("blade:user", ExtCacheConstant.TENANT_MODE); |
| | | return R.status(this.userService.updateUser(user)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperationSupport(order = 10) |
| | | @PostResource({"/update-info"}) |
| | | @ApiLog("ä¿®æ¹åºæ¬ä¿¡æ¯") |
| | | @ApiOperation(value = "ä¿®æ¹åºæ¬ä¿¡æ¯", notes = "ä¼ å
¥User") |
| | | public R updateInfo(@Valid @RequestBody User user) { |
| | | CacheUtil.clear("blade:user", ExtCacheConstant.TENANT_MODE); |
| | | return R.status(this.userService.updateUserInfo(user)); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 11) |
| | | @ApiLog("ç¨æ·å表") |
| | | @GetResource({"/user-list"}) |
| | | @ApiOperation(value = "ç¨æ·å表", notes = "ä¼ å
¥user") |
| | | public R<List<User>> userList(User user, BladeUser bladeUser) { |
| | | QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user); |
| | | List<User> list = this.userService.list(!AuthUtil.isAdministrator() ? queryWrapper.lambda().eq(User::getTenantId, bladeUser.getTenantId()) : queryWrapper); |
| | | |
| | | return R.data(list); |
| | | } |
| | | |
| | | |
| | | */ |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.nio.charset.Charset; |
| | | import java.util.List; |
| | | import com.qianwen.core.boot.ctrl.BladeController; |
| | | import com.qianwen.core.datascope.props.DataScopeProperties; |
| | | import com.qianwen.core.mp.intercept.QueryInterceptor; |
| | | import com.qianwen.core.scanner.modular.annotation.GetResource; |
| | | import com.qianwen.core.scanner.modular.stereotype.ApiResource; |
| | | import com.qianwen.core.secure.annotation.PreAuth; |
| | | import com.qianwen.core.tenant.annotation.NonDS; |
| | | import com.qianwen.core.tool.api.R; |
| | | import com.qianwen.smartman.modules.cps.service.CollectDeviceTypeService; |
| | | import com.qianwen.smartman.modules.cps.service.ICommonGroupService; |
| | | import com.qianwen.smartman.modules.cps.service.WorkstationDatapointsService; |
| | | import com.qianwen.smartman.modules.cps.vo.CollectDeviceTypeVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationDatapointsVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationGroupVO; |
| | | |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | @Api(value = "test", tags = {"test"}) |
| | | @RestController |
| | | @ApiResource({"blade-cps/test"}) |
| | | public class MyTestController {// extends BladeController |
| | | |
| | | @Autowired |
| | | private WorkstationDatapointsService workstationDatapointsService; |
| | | |
| | | @Autowired |
| | | private CollectDeviceTypeService typeService; |
| | | |
| | | @Autowired |
| | | DataScopeProperties dsp; |
| | | @Autowired |
| | | QueryInterceptor qi; |
| | | @GetMapping({"/dsp"}) |
| | | @ApiOperation("dsp") |
| | | public R<String> showdsp() { |
| | | return R.data(dsp.toString()+qi); |
| | | } |
| | | |
| | | @GetMapping({"/listDatapointsByWorkstationId"}) |
| | | @ApiOperation("æ ¹æ®å·¥ä½idè·åæ°æ®ç¹") |
| | | public R<String> listDatapointsByWorkstationId() { |
| | | |
| | | //InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("dp/dpstart.json"); |
| | | String str; |
| | | try { |
| | | str = IOUtils.resourceToString("/dp/dpstart.json", Charset.forName("utf8")); |
| | | } catch (IOException e) { |
| | | str = "error"; |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return R.data(str); |
| | | } |
| | | |
| | | |
| | | @GetMapping({"/typelist"}) |
| | | @ApiOperation("ééç±»åå表") |
| | | public R<List<CollectDeviceTypeVO>> typelist() { |
| | | |
| | | |
| | | return R.data(typeService.typeList()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.qianwen.core.tenant.annotation.NonDS; |
| | | import com.qianwen.core.tool.api.R; |
| | | import com.qianwen.smartman.modules.cps.dto.WorkstationRealTimeStatusDTO; |
| | | import com.qianwen.smartman.modules.cps.entity.WorkstationDatapoints; |
| | | import com.qianwen.smartman.modules.cps.excel.WorkstationImport; |
| | | import com.qianwen.smartman.modules.cps.service.IDmpVariablesService; |
| | | import com.qianwen.smartman.modules.cps.service.IWorkstationService; |
| | | import com.qianwen.smartman.modules.cps.service.WorkstationDatapointsService; |
| | | import com.qianwen.smartman.modules.cps.vo.DmpVariablesVO; |
| | | import com.qianwen.smartman.modules.cps.vo.FmsWorkstationGroupVO; |
| | | import com.qianwen.smartman.modules.cps.vo.FmsWorkstationQueryVO; |
| | | import com.qianwen.smartman.modules.cps.vo.MachineDmpVariablesVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkMachineEasyVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationChangeCalendarVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationDatapointsVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationPageQueryVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationRealTimeStatusVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationSubmitVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationVO; |
| | | import com.qianwen.smartman.modules.resource.enums.TemplateEnum; |
| | | import com.qianwen.smartman.modules.resource.service.ISystemResourceService; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | @NonDS |
| | | @Validated |
| | | public class WorkstationController extends BladeController { |
| | | private final IWorkstationService workstationService; |
| | | private final IDmpVariablesService dmpVariablesService; |
| | | private final ISystemResourceService systemResourceService; |
| | | @Autowired |
| | | private IWorkstationService workstationService; |
| | | @Autowired |
| | | private IDmpVariablesService dmpVariablesService; |
| | | @Autowired |
| | | private ISystemResourceService systemResourceService; |
| | | |
| | | /* |
| | | public WorkstationController(final IWorkstationService workstationService, final IDmpVariablesService dmpVariablesService, final ISystemResourceService systemResourceService) { |
| | | this.workstationService = workstationService; |
| | | this.dmpVariablesService = dmpVariablesService; |
| | | this.systemResourceService = systemResourceService; |
| | | } |
| | | }*/ |
| | | |
| | | @PreAuth |
| | | @PostResource({"/submit"}) |
| | |
| | | return R.data(this.dmpVariablesService.listByWorkstationId(workstationId)); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping({"/get"}) |
| | | @ApiOperation("è·åå·¥ä½ä¿¡æ¯") |
| | | public R<WorkstationVO> get(@RequestParam Long workstationId) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.controller; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.apache.commons.codec.Charsets; |
| | | import org.apache.commons.fileupload.FileItem; |
| | | import org.apache.commons.fileupload.disk.DiskFileItem; |
| | | import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
| | | import java.util.Arrays; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.qianwen.core.boot.ctrl.BladeController; |
| | | import com.qianwen.core.excel.util.ExcelUtil; |
| | | import com.qianwen.core.mp.support.Condition; |
| | | import com.qianwen.core.mp.support.Query; |
| | | import com.qianwen.core.oss.model.BladeFile; |
| | | import com.qianwen.core.scanner.modular.annotation.GetResource; |
| | | import com.qianwen.core.scanner.modular.annotation.PostResource; |
| | | import com.qianwen.core.scanner.modular.annotation.PutResource; |
| | | import com.qianwen.core.scanner.modular.stereotype.ApiResource; |
| | | import com.qianwen.core.secure.annotation.PreAuth; |
| | | import com.qianwen.core.tenant.annotation.NonDS; |
| | | import com.qianwen.core.tool.api.R; |
| | | import com.qianwen.core.tool.utils.DateUtil; |
| | | import com.qianwen.smartman.modules.cps.dto.EmployeeDTO; |
| | | import com.qianwen.smartman.modules.cps.entity.WorkstationDatapoints; |
| | | import com.qianwen.smartman.modules.cps.service.WorkstationDatapointsService; |
| | | import com.qianwen.smartman.modules.cps.vo.EmployeeSelectVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationDatapointsSubmitVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationDatapointsVO; |
| | | import com.qianwen.smartman.modules.cps.wrapper.EmployeeExcelWrapper; |
| | | import com.qianwen.smartman.modules.resource.builder.oss.OssBuilder; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | @Api(value = "å·¥ä½ç®¡ç", tags = {"å·¥ä½ç®¡ç"}) |
| | | @RestController |
| | | @ApiResource({"blade-cps/workstation"}) |
| | | @NonDS |
| | | @Validated |
| | | public class WorkstationDpController extends BladeController { |
| | | @Autowired |
| | | private WorkstationDatapointsService workstationDatapointsService; |
| | | @Autowired |
| | | private OssBuilder ossBuilder; |
| | | |
| | | //@PreAuth |
| | | @GetResource({"/listDatapointsByWorkstationId"}) |
| | | @ApiOperation("æ ¹æ®å·¥ä½idè·åæ°æ®ç¹") |
| | | public R<WorkstationDatapointsVO> listDatapointsByWorkstationId(@RequestParam Long workstationId) { |
| | | WorkstationDatapointsVO v = new WorkstationDatapointsVO(); |
| | | v.setDpHead("myhead"); |
| | | //return R.data(v); |
| | | return R.data(workstationDatapointsService.getDatapoints(workstationId)); |
| | | } |
| | | |
| | | @PutResource({"/saveDatapoints"}) |
| | | @ApiOperation("ä¿å工使°æ®ç¹é
ç½®") |
| | | public R<Boolean> saveDatapoints(@RequestBody WorkstationDatapointsSubmitVO datapoints) { |
| | | //return R.data(true); |
| | | try { |
| | | workstationDatapointsService.submit(datapoints); |
| | | }catch(Exception e) { |
| | | return R.data(false); |
| | | } |
| | | return R.data(true); |
| | | } |
| | | |
| | | @ApiOperationSupport(order = 7) |
| | | @GetResource({"/export-dp"}) |
| | | @ApiOperation("导åºå·¥ä½æ°æ®ç¹") |
| | | @PreAuth |
| | | public R<BladeFile> exportDatapoints(long workstationId) { |
| | | //List<EmployeeExcel> list = EmployeeExcelWrapper.build().pageVO(pages).getRecords(); |
| | | String fileName = String.format("%s-%s.xlsx", "ç¹ä½é
ç½®", DateUtil.time()); |
| | | |
| | | WorkstationDatapointsVO dpVO = workstationDatapointsService.getDatapoints(workstationId); |
| | | |
| | | |
| | | List<List<String>> head = new ArrayList<>(); |
| | | head.add(Arrays.asList("åç§°","å«å")); |
| | | |
| | | List<List<Object>> data = new ArrayList<>(); |
| | | |
| | | data.add(Arrays.asList("DeviceStatus","alias")); |
| | | |
| | | MultipartFile multipartFile = exportExcel("sheet1",fileName,head(dpVO.getDpHead()),data(dpVO.getDpHead(),dpVO.getDpConfig())); |
| | | BladeFile bladeFile = this.ossBuilder.tempTemplate().putFile(multipartFile.getOriginalFilename(), multipartFile); |
| | | return R.data(bladeFile); |
| | | //return null; |
| | | } |
| | | |
| | | List<List<Object>> data(String dpHead,String dpConfig){ |
| | | List<List<Object>> result = new ArrayList<>(); |
| | | JSONArray headsJson = JSONArray.parseArray(dpHead); |
| | | |
| | | JSONArray dataJson = JSONArray.parseArray(dpConfig); |
| | | JSONObject rowJson; |
| | | JSONObject headOne ; |
| | | String prop; |
| | | List<Object> rowData; |
| | | for(int i=0;i<dataJson.size();i++) { |
| | | rowJson = dataJson.getJSONObject(i); |
| | | rowData = new ArrayList<>(); |
| | | |
| | | for(int j=0;j<headsJson.size();j++) { |
| | | headOne = headsJson.getJSONObject(j); |
| | | prop = headOne.getString("prop"); |
| | | if(rowJson.containsKey(prop)) { |
| | | rowData.add(rowJson.getString(prop)); |
| | | }else { |
| | | rowData.add(""); |
| | | } |
| | | } |
| | | |
| | | result.add(rowData); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | List<List<String>> head(String dpHeadFullJsonStr){ |
| | | List<List<String>> head = new ArrayList<>(); |
| | | JSONArray headsJson = JSONArray.parseArray(dpHeadFullJsonStr); |
| | | |
| | | JSONObject headOne ; |
| | | boolean isRequired; |
| | | String title; |
| | | for(int i=0;i<headsJson.size();i++) { |
| | | List<String> head0 = new ArrayList<>(); |
| | | |
| | | headOne = headsJson.getJSONObject(i); |
| | | if(headOne.containsKey("isRequired")) { |
| | | isRequired = headOne.getBooleanValue("isRequired"); |
| | | }else { |
| | | isRequired = false; |
| | | } |
| | | title = (isRequired?"*":"") + headOne.getString("label"); |
| | | head0.add(title); |
| | | |
| | | head.add(head0); |
| | | } |
| | | return head; |
| | | } |
| | | |
| | | /** |
| | | * å¨æè¡¨å¤´å¯¼åº |
| | | * |
| | | * @param response HttpServletResponse |
| | | * @param fileName æä»¶å |
| | | * @param Myhead Excelè¡¨å¤´ä¿¡æ¯ |
| | | * @param data Excelæ°æ® |
| | | */ |
| | | public MultipartFile exportExcel(String sheetName,String filename, List<List<String>> myhead, List<List<Object>> data) { |
| | | try { |
| | | |
| | | DiskFileItemFactory factory = new DiskFileItemFactory(); |
| | | factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); |
| | | //factory.setRepository(new File("d:/")); |
| | | FileItem fileItem = factory.createItem("excel", "application/vnd.ms-excel", true, filename); |
| | | |
| | | EasyExcel.write(fileItem.getOutputStream()) |
| | | .head(myhead) |
| | | .sheet(sheetName) |
| | | .doWrite(data); |
| | | |
| | | return new CommonsMultipartFile(fileItem); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.qianwen.core.mp.base.BaseEntity; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | | * éé设å¤ç±»å,å®ä¹ç¹ä½å段 |
| | | */ |
| | | @TableName("collect_device_type") |
| | | public class CollectDeviceType extends BaseEntity { |
| | | private static final long serialVersionUID = 1; |
| | | @ApiModelProperty("ç±»ååç§°") |
| | | private String name; |
| | | |
| | | /** |
| | | * æ¯ä¸ªåæ®µä¿¡æ¯æ ¼å¼ï¼{"prop":"dpName","isRequired":true,"label":"æ°æ®ç¹åç§°","describe":"æ°æ®ç¹åç§°ï¼åä¸åºç¨ä¸çæ°æ®ç¹åç§°ä¸å
许éå¤ã"} |
| | | */ |
| | | @ApiModelProperty("åæ®µä¿¡æ¯ï¼jsonæ°ç»") |
| | | private String dpHead; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getDpHead() { |
| | | return dpHead; |
| | | } |
| | | |
| | | public void setDpHead(String dpHead) { |
| | | this.dpHead = dpHead; |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.qianwen.core.mp.base.BaseEntity; |
| | | import com.qianwen.core.tenant.mp.TenantEntity; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | |
| | | /** |
| | | * é鿍¡æ¿ |
| | | */ |
| | | @TableName("collect_template") |
| | | public class CollectTemplate extends BaseEntity { |
| | | private static final long serialVersionUID = 1; |
| | | @ApiModelProperty("模æ¿åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("模æ¿ç±»å") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("ç¹ä½é
ç½®(jsonæ°ç»)") |
| | | private String dpConfig; |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getDpConfig() { |
| | | return dpConfig; |
| | | } |
| | | |
| | | public void setDpConfig(String dpConfig) { |
| | | this.dpConfig = dpConfig; |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.qianwen.core.mp.base.BaseEntity; |
| | | import com.qianwen.core.tenant.mp.TenantEntity; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | |
| | | /** |
| | | * å·¥ä½ééæ°æ®ç¹ |
| | | */ |
| | | @TableName("workstation_datapoints") |
| | | public class WorkstationDatapoints extends BaseEntity { |
| | | private static final long serialVersionUID = 1; |
| | | |
| | | @ApiModelProperty("模æ¿ç±»å") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("ç¹ä½é
ç½®(jsonæ°ç»)") |
| | | private String dpConfig; |
| | | |
| | | /** |
| | | * å·¥ä½id |
| | | */ |
| | | private long workstationId; |
| | | |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getDpConfig() { |
| | | return dpConfig; |
| | | } |
| | | |
| | | public void setDpConfig(String dpConfig) { |
| | | this.dpConfig = dpConfig; |
| | | } |
| | | |
| | | public long getWorkstationId() { |
| | | return workstationId; |
| | | } |
| | | |
| | | public void setWorkstationId(long workstationId) { |
| | | this.workstationId = workstationId; |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.mapper; |
| | | |
| | | import com.qianwen.core.mp.mapper.BladeMapper; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectDeviceType; |
| | | |
| | | |
| | | public interface CollectDeviceTypeMapper extends BladeMapper<CollectDeviceType> { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.qianwen.core.mp.mapper.BladeMapper; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectDeviceType; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectTemplate; |
| | | import com.qianwen.smartman.modules.system.entity.User; |
| | | |
| | | |
| | | public interface CollectTemplateMapper extends BladeMapper<CollectTemplate> { |
| | | |
| | | List<CollectTemplate> selectPage(@Param("page")IPage<CollectTemplate> page,@Param("template") CollectTemplate tpl); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.qianwen.core.mp.mapper.BladeMapper; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectDeviceType; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectTemplate; |
| | | import com.qianwen.smartman.modules.cps.entity.WorkstationDatapoints; |
| | | import com.qianwen.smartman.modules.system.entity.User; |
| | | |
| | | |
| | | public interface WorkstationDatapointsMapper extends BladeMapper<WorkstationDatapoints> { |
| | | |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.service; |
| | | |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectDeviceType; |
| | | import com.qianwen.smartman.modules.cps.mapper.CollectDeviceTypeMapper; |
| | | import com.qianwen.smartman.modules.cps.vo.CollectDeviceTypeVO; |
| | | |
| | | @Service |
| | | public class CollectDeviceTypeService extends BaseServiceImpl<CollectDeviceTypeMapper, CollectDeviceType> { |
| | | |
| | | |
| | | /** |
| | | * æ°å¢æè
æ´æ°æ¨¡æ¿ |
| | | * @param tpl |
| | | */ |
| | | public List<CollectDeviceTypeVO> typeList() { |
| | | |
| | | List<CollectDeviceType> list = this.baseMapper.selectList(Wrappers.emptyWrapper()); |
| | | Charset utf8charset = Charset.forName("utf8"); |
| | | String startJsonStr= "[]"; |
| | | String endJsonStr = "[]"; |
| | | try { |
| | | startJsonStr = IOUtils.resourceToString("/dp/dpstart.json", utf8charset); |
| | | endJsonStr = IOUtils.resourceToString("/dp/dpend.json", utf8charset); |
| | | } catch (IOException e) { |
| | | log.error("读åé»è®¤dpHeadå¼å¸¸",e); |
| | | } |
| | | final String startStr = startJsonStr; |
| | | final String endStr = endJsonStr; |
| | | List<CollectDeviceTypeVO> voList = list.stream().map(t -> { |
| | | |
| | | CollectDeviceTypeVO vo = new CollectDeviceTypeVO(); |
| | | vo.setId(t.getId()); |
| | | vo.setDpHead(t.getDpHead()); |
| | | vo.setName(t.getName()); |
| | | |
| | | vo.setDpHeadFull(mergeJson(startStr,t.getDpHead(),endStr)); |
| | | |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | return voList; |
| | | } |
| | | |
| | | public static String mergeJson(String start,String dpHead,String end) { |
| | | JSONArray s = JSONArray.parseArray(start); |
| | | JSONArray h = JSONArray.parseArray(dpHead); |
| | | JSONArray e = JSONArray.parseArray(end); |
| | | |
| | | s.addAll(h); |
| | | s.addAll(e); |
| | | |
| | | return s.toJSONString(); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.service; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.core.tool.utils.StringUtil; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectTemplate; |
| | | import com.qianwen.smartman.modules.cps.mapper.CollectTemplateMapper; |
| | | import com.qianwen.smartman.modules.cps.vo.CollectTemplateVO; |
| | | import com.qianwen.smartman.modules.cps.wrapper.CollectTemplateWrapper; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | |
| | | @Service |
| | | public class CollectTemplateService extends BaseServiceImpl<CollectTemplateMapper, CollectTemplate> { |
| | | |
| | | |
| | | /** |
| | | * æ°å¢æè
æ´æ°æ¨¡æ¿ |
| | | * @param tpl |
| | | */ |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public void submit(CollectTemplateVO tplVO) { |
| | | |
| | | Long userCount = this.baseMapper.selectCount(Wrappers.<CollectTemplate>query().lambda().eq(CollectTemplate::getName, tplVO.getName())); |
| | | |
| | | if (userCount > 0 && ObjectUtil.isEmpty(tplVO.getId())) { |
| | | throw new ServiceException(StringUtil.format("模æ¿åç§° [{}] å·²åå¨!", new Object[]{tplVO.getName()})); |
| | | } |
| | | CollectTemplate tpl = new CollectTemplate(); |
| | | tpl.setId(tplVO.getId()); |
| | | tpl.setDpConfig(tplVO.getDpConfig()); |
| | | tpl.setName(tplVO.getName()); |
| | | tpl.setType(tplVO.getType()); |
| | | tpl.setIsDeleted(0); |
| | | |
| | | saveOrUpdate(tpl); |
| | | } |
| | | |
| | | /** |
| | | * å 餿¨¡æ¿ï¼é»è¾å é¤) |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean removeTemplate(String ids) { |
| | | |
| | | return deleteLogic(Func.toLongList(ids)); |
| | | } |
| | | |
| | | public CollectTemplateVO detail(long id) { |
| | | CollectTemplate tpl = this.getById(id); |
| | | CollectTemplateVO result = CollectTemplateWrapper.build().entityVO(tpl); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public IPage<CollectTemplate> selectPage(IPage<CollectTemplate> page, CollectTemplate tpl) { |
| | | |
| | | return page.setRecords(this.baseMapper.selectPage(page, tpl)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | List<DmpVariablesVO> queryDmpList(String workstationId); |
| | | |
| | | /** |
| | | * æ°å¢ææ´æ¹å·¥ä½ä¿¡æ¯ |
| | | * @param workstationSubmitVO |
| | | * @return |
| | | */ |
| | | WorkstationVO submit(WorkstationSubmitVO workstationSubmitVO); |
| | | |
| | | Boolean changeCollectSwitch(Long workstationId, Integer collectSwitch); |
| | |
| | | |
| | | Boolean changeCalendarCode(WorkstationChangeCalendarVO workstationChangeCalendarVO); |
| | | |
| | | /** |
| | | * æ´æ°ææå·¥ä½çç产æ¥ååæ®µï¼ç¨calendarCodeWaitingæ´æ°calendarCodeãå¨å®æ¶ä»»å¡æ¶è°ç¨ |
| | | */ |
| | | void updateWorkstationCalendar(); |
| | | |
| | | Boolean changeWorkstationGroup(Long groupId, List<Long> workstationIdList); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.service; |
| | | |
| | | import java.io.IOException; |
| | | import java.nio.charset.Charset; |
| | | |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectDeviceType; |
| | | import com.qianwen.smartman.modules.cps.entity.WorkstationDatapoints; |
| | | import com.qianwen.smartman.modules.cps.mapper.CollectDeviceTypeMapper; |
| | | import com.qianwen.smartman.modules.cps.mapper.WorkstationDatapointsMapper; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationDatapointsSubmitVO; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationDatapointsVO; |
| | | |
| | | @Service |
| | | public class WorkstationDatapointsService extends BaseServiceImpl<WorkstationDatapointsMapper, WorkstationDatapoints> { |
| | | private Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | @Autowired |
| | | private CollectDeviceTypeMapper typeMapper; |
| | | |
| | | /** |
| | | * æ°å¢æè
ä¿®æ¹å·¥ä½ç¹ä½é
ç½® |
| | | * @param tplVO |
| | | */ |
| | | @Transactional |
| | | public void submit(WorkstationDatapointsSubmitVO dpVO) { |
| | | |
| | | WorkstationDatapoints dp = this.baseMapper.selectOne(Wrappers.<WorkstationDatapoints>lambdaQuery().eq(WorkstationDatapoints::getWorkstationId, dpVO.getWorkstationId())); |
| | | |
| | | if (dp == null) { |
| | | //æ°å¢ |
| | | //throw new ServiceException(StringUtil.format("模æ¿åç§° [{}] å·²åå¨!", new Object[]{tplVO.getName()})); |
| | | dp = new WorkstationDatapoints(); |
| | | dp.setDpConfig(dpVO.getDpConfig()); |
| | | dp.setIsDeleted(0); |
| | | dp.setWorkstationId(dpVO.getWorkstationId()); |
| | | dp.setType(dpVO.getType()); |
| | | }else { |
| | | dp.setDpConfig(dpVO.getDpConfig()); |
| | | dp.setIsDeleted(0); |
| | | dp.setWorkstationId(dpVO.getWorkstationId()); |
| | | dp.setType(dpVO.getType()); |
| | | } |
| | | |
| | | saveOrUpdate(dp); |
| | | } |
| | | |
| | | /** |
| | | * è·å工使°æ®ç¹é
ç½® |
| | | * @param workstationId |
| | | * @return |
| | | */ |
| | | public WorkstationDatapointsVO getDatapoints(Long workstationId) { |
| | | log.info("woid={}",workstationId); |
| | | WorkstationDatapoints dp = baseMapper.selectOne(Wrappers.<WorkstationDatapoints>lambdaQuery().eq(WorkstationDatapoints::getWorkstationId, workstationId)); |
| | | |
| | | log.info("dp={}",dp); |
| | | |
| | | WorkstationDatapointsVO dpVO = new WorkstationDatapointsVO(); |
| | | dpVO.setWorkstationId(workstationId); |
| | | if(dp != null) { |
| | | |
| | | dpVO.setDpConfig(dp.getDpConfig()); |
| | | dpVO.setType(dp.getType()); |
| | | |
| | | Charset utf8charset = Charset.forName("utf8"); |
| | | String startJsonStr= "[]"; |
| | | String endJsonStr = "[]"; |
| | | try { |
| | | startJsonStr = IOUtils.resourceToString("/dp/dpstart.json", utf8charset); |
| | | endJsonStr = IOUtils.resourceToString("/dp/dpend.json", utf8charset); |
| | | } catch (IOException e) { |
| | | log.error("读åé»è®¤dpHeadå¼å¸¸",e); |
| | | } |
| | | |
| | | CollectDeviceType collectType = typeMapper.selectById(dp.getType()); |
| | | String fullHead = CollectDeviceTypeService.mergeJson(startJsonStr,collectType.getDpHead(),endJsonStr); |
| | | dpVO.setDpHead(fullHead); |
| | | |
| | | } |
| | | return dpVO; |
| | | } |
| | | |
| | | } |
| | |
| | | public ProductionCalendar updateCalendar(CalendarUpdateVO calendarUpdateVO) { |
| | | this.calendarDayService.deleteByCalendarId(calendarUpdateVO.getId()); |
| | | this.calendarDaytimeService.deleteByCalendarId(calendarUpdateVO.getId()); |
| | | ProductionCalendar calendar = (ProductionCalendar) getById(calendarUpdateVO.getId()); |
| | | ProductionCalendar calendar = getById(calendarUpdateVO.getId()); |
| | | updateCalendarDayTime(calendarUpdateVO.getDateDTOList(), calendar); |
| | | return calendar; |
| | | } |
| | |
| | | .eq(ProductionCalendarDaytime::getCalendarId, calendarId) |
| | | .orderByAsc(ProductionCalendarDaytime::getStartTime)); |
| | | |
| | | /* |
| | | List<ProductionCalendarDaytime> todayDateTimeList = this.calendarDaytimeService.list((Wrapper) ((LambdaQueryWrapper) ((LambdaQueryWrapper) new QueryWrapper().lambda().eq((v0) -> { |
| | | return v0.getCalendarDate(); |
| | | }, LocalDate.now())).eq((v0) -> { |
| | | return v0.getCalendarId(); |
| | | }, calendarId)).orderByAsc((v0) -> { |
| | | return v0.getStartTime(); |
| | | }));*/ |
| | | |
| | | List<ProductionCalendarDaytime> curProductionCalendarDayTimeList = new ArrayList<>(); |
| | | LocalDate lastDayOfYear = LocalDateTimeUtils.getLastDayOfYear(LocalDate.now()); |
| | | long difference = year.intValue() == LocalDate.now().getYear() ? LocalDateTimeUtils.getDifference(LocalDate.now(), lastDayOfYear).intValue() : LocalDateTimeUtils.getDayOfYear(year).intValue() - 1; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public Boolean associateWorkstation(CalendarAssociateWorkstationVO calendarAssociateWorkstationVO) { |
| | | return this.workstationService.update(Wrappers.<Workstation>lambdaUpdate() |
| | | boolean result = this.workstationService.update(Wrappers.<Workstation>lambdaUpdate() |
| | | .set(Workstation::getCalendarCodeWaiting, calendarAssociateWorkstationVO.getCalendarCode()) |
| | | .in(Workstation::getId, calendarAssociateWorkstationVO.getWorkstationIdList())); |
| | | |
| | | return result; |
| | | /* |
| | | return Boolean.valueOf(this.workstationService.update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate().set((v0) -> { |
| | | return v0.getCalendarCodeWaiting(); |
| | |
| | | }, calendarAssociateWorkstationVO.getWorkstationIdList())));*/ |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<ShiftIndexNameDTO> queryShiftIndexName(String calendarCode, Integer year, String day) { |
| | | Integer maxShiftIndex; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°åå·¥ä¸å²ä½å¯¹åºå
³ç³»è¡¨ |
| | | * @param update |
| | | * @param employeeId |
| | | * @param postId |
| | | */ |
| | | private void submitEmployeePost(Boolean update, Long employeeId, String postId) { |
| | | if (update.booleanValue()) { |
| | | this.employeePostService.remove(Wrappers.<EmployeePost>lambdaQuery().eq(EmployeePost::getEmployeeId, employeeId)); |
| | |
| | | |
| | | @Override |
| | | public Boolean changeCalendarCode(WorkstationChangeCalendarVO workstationChangeCalendarVO) { |
| | | Workstation workstation = (Workstation) getById(workstationChangeCalendarVO.getWorkstationId()); |
| | | Workstation workstation = getById(workstationChangeCalendarVO.getWorkstationId()); |
| | | workstation.setCalendarCodeWaiting(workstationChangeCalendarVO.getCalendarCodeWaiting()); |
| | | return Boolean.valueOf(updateById(workstation)); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | /** |
| | | * éé设å¤ç±»å,å®ä¹ç¹ä½å段 |
| | | */ |
| | | public class CollectDeviceTypeVO{ |
| | | private long id; |
| | | @ApiModelProperty("ç±»ååç§°") |
| | | private String name; |
| | | |
| | | /** |
| | | * æ¯ä¸ªåæ®µä¿¡æ¯æ ¼å¼ï¼{"prop":"dpName","isRequired":true,"label":"æ°æ®ç¹åç§°","describe":"æ°æ®ç¹åç§°ï¼åä¸åºç¨ä¸çæ°æ®ç¹åç§°ä¸å
许éå¤ã"} |
| | | */ |
| | | @ApiModelProperty("åæ®µä¿¡æ¯ï¼jsonæ°ç»") |
| | | private String dpHead; |
| | | |
| | | @ApiModelProperty("å
¨é¨å段信æ¯ï¼jsonæ°ç»") |
| | | private String dpHeadFull; |
| | | |
| | | |
| | | public long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getDpHead() { |
| | | return dpHead; |
| | | } |
| | | |
| | | public void setDpHead(String dpHead) { |
| | | this.dpHead = dpHead; |
| | | } |
| | | |
| | | public String getDpHeadFull() { |
| | | return dpHeadFull; |
| | | } |
| | | |
| | | public void setDpHeadFull(String dpHeadFull) { |
| | | this.dpHeadFull = dpHeadFull; |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.vo; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.qianwen.core.tenant.mp.TenantEntity; |
| | | import com.qianwen.core.tool.utils.ObjectUtil; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | |
| | | /** |
| | | * é鿍¡æ¿ |
| | | */ |
| | | |
| | | public class CollectTemplateVO { |
| | | private static final long serialVersionUID = 1; |
| | | private long id; |
| | | |
| | | @ApiModelProperty("模æ¿åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("模æ¿ç±»å") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("ç¹ä½é
ç½®(jsonæ°ç»)") |
| | | private String dpConfig; |
| | | |
| | | public long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getDpConfig() { |
| | | return dpConfig; |
| | | } |
| | | |
| | | public void setDpConfig(String dpConfig) { |
| | | this.dpConfig = dpConfig; |
| | | } |
| | | |
| | | public JSONArray getDpConfigJson() { |
| | | //JSONValidator |
| | | if(ObjectUtil.isNotEmpty(this.dpConfig)) { |
| | | return JSONArray.parseArray(dpConfig); |
| | | }else { |
| | | return JSONArray.parseArray("[]"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | |
| | | /** |
| | | * å·¥ä½ééæ°æ®ç¹ä¿åVO |
| | | */ |
| | | public class WorkstationDatapointsSubmitVO { |
| | | private static final long serialVersionUID = 1; |
| | | |
| | | @ApiModelProperty("模æ¿ç±»å") |
| | | private Integer type; |
| | | |
| | | |
| | | @ApiModelProperty("ç¹ä½é
ç½®(jsonæ°ç»)") |
| | | private String dpConfig; |
| | | |
| | | /** |
| | | * å·¥ä½id |
| | | */ |
| | | private long workstationId; |
| | | |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getDpConfig() { |
| | | return dpConfig; |
| | | } |
| | | |
| | | public void setDpConfig(String dpConfig) { |
| | | this.dpConfig = dpConfig; |
| | | } |
| | | |
| | | public long getWorkstationId() { |
| | | return workstationId; |
| | | } |
| | | |
| | | public void setWorkstationId(long workstationId) { |
| | | this.workstationId = workstationId; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | |
| | | /** |
| | | * å·¥ä½ééæ°æ®ç¹VO |
| | | */ |
| | | public class WorkstationDatapointsVO { |
| | | private static final long serialVersionUID = 1; |
| | | |
| | | @ApiModelProperty("模æ¿ç±»å") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("ç¹ä½è¡¨å¤´(jsonæ°ç»)") |
| | | private String dpHead; |
| | | |
| | | @ApiModelProperty("ç¹ä½é
ç½®(jsonæ°ç»)") |
| | | private String dpConfig; |
| | | |
| | | /** |
| | | * å·¥ä½id |
| | | */ |
| | | private long workstationId; |
| | | |
| | | |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getDpConfig() { |
| | | return dpConfig; |
| | | } |
| | | |
| | | public void setDpConfig(String dpConfig) { |
| | | this.dpConfig = dpConfig; |
| | | } |
| | | |
| | | public long getWorkstationId() { |
| | | return workstationId; |
| | | } |
| | | |
| | | public void setWorkstationId(long workstationId) { |
| | | this.workstationId = workstationId; |
| | | } |
| | | |
| | | public String getDpHead() { |
| | | return dpHead; |
| | | } |
| | | |
| | | public void setDpHead(String dpHead) { |
| | | this.dpHead = dpHead; |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.qianwen.smartman.modules.cps.wrapper; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | import com.qianwen.core.mp.support.BaseEntityWrapper; |
| | | import com.qianwen.core.tool.utils.BeanUtil; |
| | | import com.qianwen.smartman.modules.cps.entity.CollectTemplate; |
| | | import com.qianwen.smartman.modules.cps.vo.CollectTemplateVO; |
| | | |
| | | public class CollectTemplateWrapper extends BaseEntityWrapper<CollectTemplate, CollectTemplateVO> { |
| | | public static CollectTemplateWrapper build() { |
| | | return new CollectTemplateWrapper(); |
| | | } |
| | | |
| | | /** |
| | | * å®ä½è½¬æ¢ä¸ºVO |
| | | */ |
| | | public CollectTemplateVO entityVO(CollectTemplate tpl) { |
| | | CollectTemplateVO tplVO = Objects.requireNonNull(BeanUtil.copy(tpl, CollectTemplateVO.class)); |
| | | |
| | | |
| | | return tplVO; |
| | | } |
| | | } |
| | |
| | | }).collect(Collectors.toList()); |
| | | List<IntervalDateDto> intervalDates = LocalDateTimeUtils.getIntervalDate(statisticsAnalysisQueryVO.getStartDate(), statisticsAnalysisQueryVO.getEndDate()); |
| | | List<SuperAggregateOutput> superAggregateOutputByNaturalDate = this.superAggregateOutputService.getOutputData(workstationIds, statisticsAnalysisQueryVO.getStatisticalMethod(), statisticsAnalysisQueryVO.getStartDate(), statisticsAnalysisQueryVO.getEndDate()); |
| | | |
| | | List<SuperAggregateOutput> superAggregateList = FilterOffUtils.filterOffDay(superAggregateOutputByNaturalDate, OpenTypeEnums.OUT_PUT); |
| | | StatisticsWrapperDto statisticsWrapperDto = new StatisticsWrapperDto(superAggregateList, statisticsAnalysisQueryVO, intervalDates, workstationPage, MdcConstant.OUTPUT); |
| | | return this.wrapper.entityVO(statisticsWrapperDto); |
| | |
| | | if (Func.isEmpty(data)) { |
| | | return data; |
| | | } |
| | | //boolean filterType = whetherToFilter(OpenTypeEnums.PARAM_KEY_TYPE, openTypeEnums);//mdc_open_typeï¼æ¯å¦è¿æ»¤è¯¥ç±»å |
| | | //boolean filterShift = whetherToFilter(OpenTypeEnums.PARAM_KEY_SHIFT, openTypeEnums);//mdc_open_shiftï¼æ¯å¦è¿æ»¤çå¶ |
| | | boolean filterType = whetherToFilter(OpenTypeEnums.PARAM_KEY_TYPE, openTypeEnums);//mdc_open_typeï¼æ¯å¦è¿æ»¤è¯¥ç±»å |
| | | boolean filterShift = whetherToFilter(OpenTypeEnums.PARAM_KEY_SHIFT, openTypeEnums);//mdc_open_shiftï¼æ¯å¦è¿æ»¤çå¶ |
| | | //è¿éç®åï¼ä¸è¿æ»¤äºï¼æ°æ®å¨winæå¡å¨æï¼blade_boot_blade_param-0418bak.sqlæï¼æ¯ä¸ªjsonæ°ç» |
| | | boolean filterType = false; |
| | | boolean filterShift = false; |
| | | //boolean filterType = false; |
| | | // boolean filterShift = false; |
| | | if (!filterType && !filterShift) { |
| | | return data; |
| | | } |
| | |
| | | @PreAuth("permitAll()") |
| | | public R<List<Dept>> select(String deptId) { |
| | | List<Dept> list = this.dataScopeManagerService.list(Wrappers.<Dept>lambdaQuery().in(Dept::getId, Func.toLongList(deptId))); |
| | | /* |
| | | List<Dept> list = this.dataScopeManagerService.list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getId(); |
| | | }, Func.toLongList(deptId)));*/ |
| | | |
| | | return R.data(list); |
| | | } |
| | | |
| | |
| | | public R<Boolean> grant(@RequestBody DataScopeGrantVO grantVO) { |
| | | CacheUtil.clear("blade:sys"); |
| | | CacheUtil.clear("blade:sys", Boolean.FALSE); |
| | | this.dataScopeManagerService.grant(grantVO); |
| | | return R.status(true); |
| | | return R.status(this.dataScopeManagerService.grant(grantVO)); |
| | | } |
| | | } |
| | |
| | | |
| | | List<DeptVO> search(String deptName, Long parentId); |
| | | |
| | | /** |
| | | * æ°æ®æéææ |
| | | * @param grantVO |
| | | * @return |
| | | */ |
| | | boolean grant(DataScopeGrantVO grantVO); |
| | | |
| | | List<String> grantSelect(String deptId); |
| | |
| | | @Override |
| | | @Transactional |
| | | public boolean grant(final DataScopeGrantVO grantVO) { |
| | | this.deptScopeService.remove(Lambda.eq((v0) -> { |
| | | return v0.getDeptId(); |
| | | }, grantVO.getDeptId())); |
| | | this.deptScopeService.remove(Lambda.eq(DeptScope::getDeptId, grantVO.getDeptId())); |
| | | |
| | | List<DeptScope> deptScopeList = grantVO.getDataScopeIds().stream().map(scopeId -> { |
| | | DeptScope scope = new DeptScope(); |
| | | scope.setScopeId(scopeId); |
| | |
| | | |
| | | iotdb: |
| | | driver: org.apache.iotdb.jdbc.IoTDBDriver |
| | | host: localhost |
| | | host: 120.46.212.231 |
| | | port: 6667 |
| | | maxSize: 10 |
| | | username: root |
| | |
| | | - /blade-cps/workstation/page |
| | | - /blade-cps/group/groupWorkstation/jimu |
| | | - /blade-fms/order/process/issued |
| | | - /blade-cps/test/** |
| | | #ææè®¤è¯é
ç½® |
| | | auth: |
| | | - method: ALL |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.qianwen.smartman.modules.cps.mapper.CollectDeviceTypeMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.qianwen.smartman.modules.cps.entity.CollectDeviceType"> |
| | | <result column="id" property="id"/> |
| | | |
| | | <result column="name" property="name"/> |
| | | <result column="dp_head" property="dpHead"/> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.qianwen.smartman.modules.cps.mapper.CollectTemplateMapper"> |
| | | |
| | | <!-- éç¨æ¥è¯¢æ å°ç»æ --> |
| | | <resultMap id="BaseResultMap" type="com.qianwen.smartman.modules.cps.entity.CollectTemplate"> |
| | | <result column="id" property="id"/> |
| | | <result column="tenant_id" property="tenantId"/> |
| | | |
| | | <result column="type" property="type"/> |
| | | <result column="dp_config" property="dpConfig"/> |
| | | </resultMap> |
| | | |
| | | <select id="selectPage" resultMap="BaseResultMap"> |
| | | select * from collect_template where is_deleted=0 |
| | | |
| | | <if test="template.name!=null and template.name != ''"> |
| | | and (name like CONCAT(#{template.name},'%') OR name like CONCAT(#{template.name},'%')) |
| | | </if> |
| | | <if test="template.type!=null and template.type != ''"> |
| | | and type = #{user.type} |
| | | </if> |
| | | |
| | | ORDER BY id |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | [{"prop":"dpUnit","label":"åä½"},{"prop":"ruleContent","label":"计ç®è§å","describe":"计ç®è§åæ¥æºäº[è§å管ç-计ç®è§å]ï¼éè¿luaèæ¬ç¼å计ç®è§åï¼å¯¹æ°æ®ç¹çåå§æ°æ®è¿è¡è®¡ç®ï¼çææ°çæ°æ®ç¹åæ°æ®ç¹å¼ã","sendCode":1,"isReqOptions":true,"type":"option","options":[]},{"prop":"ruleArgs","label":"计ç®åæ°","describe":"æ ¹æ®è®¡ç®è§åï¼å¡«å计ç®åæ°ï¼å¤ä¸ªè®¡ç®åæ°ç¨è±æâï¼âéå¼ï¼æ³¨æ:dpValue为ééå°çå¼ä¸éè¦å¡«åã","sendCode":1},{"prop":"access","isRequired":true,"sendCode":1,"label":"æé","describe":"读åæé\\n RO(åªè¯»)ï¼åªå
许读åç¹ä½æ°æ®ã\\nRW(读/å)ï¼æ¢è½è¯»åæ°æ®ä¹è½åå
¥æ°æ®ã","default":"RO","type":"option","options":["RO","RW"]},{"prop":"pollingInterval","isRequired":true,"label":"轮询é´éï¼msï¼","describe":"轮询é´éï¼msï¼","default":1000},{"prop":"keepOriginalValue","isRequired":true,"sendCode":1,"label":"ä¿çåå§å¼","describe":"ä¿çåå§å¼","default":true,"type":"boolean"},{"prop":"isSave","isRequired":true,"sendCode":1,"label":"æ¯å¦åå¨","describe":"æ¯å¦åå¨","default":true,"type":"boolean"}] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | [{"prop":"dpName","isRequired":true,"label":"æ°æ®ç¹åç§°","describe":"æ°æ®ç¹åç§°ï¼åä¸åºç¨ä¸çæ°æ®ç¹åç§°ä¸å
许éå¤ã"},{"prop":"dpAlias","label":"æ°æ®ç¹å«å","describe":"æ°æ®ç¹å«åã"}] |