diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/po/Template.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/po/Template.java index 2cc41e4..894081f 100644 --- a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/po/Template.java +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/project/po/Template.java @@ -47,7 +47,7 @@ public class Template extends BaseEntity { @TableField(value = "template_alias") @Condition(name = "template_alias") private String templateAlias; - @NotNull(message = "模板所属任务不能为空",groups = {Create.class, Update.class}) + @TableField(value = "task_id") @Condition(name = "task_id") private Long taskId; @@ -58,5 +58,5 @@ public class Template extends BaseEntity { @TableField(value = "template_type") @Condition(name = "template_type") @DictFormat(dictType = "template_type") - private Integer templateType; + private String templateType; } diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/dto/StoreImportDTO.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/dto/StoreImportDTO.java new file mode 100644 index 0000000..500f7ea --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/dto/StoreImportDTO.java @@ -0,0 +1,192 @@ +package com.chushang.inspection.terminal.dto; + +import cn.hutool.core.date.DatePattern; +import com.alibaba.excel.annotation.ExcelIgnore; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.chushang.common.dict.annotation.DictFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Range; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Past; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.time.LocalDate; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class StoreImportDTO implements Serializable { + + /** + * 主键 + */ + @ExcelIgnore + private Long id; + /** + * 商户编号 + */ + @ExcelProperty(value = "商户编号") + @NotBlank(message = "商户编号不能为空") + @Size(max = 64, message = "商户编号不能大于64个字符") + private String storeNo; + /** + * 商户名称 + */ + @ExcelProperty(value = "商户名称") + @Size(max = 128, message = "商户名称不能大于128个字符") + private String storeName; + /** + * 商户联系人 + */ + @ExcelProperty(value = "商户联系人") + @Size(max = 128, message = "商户联系人不能大于128个字符") + private String storeContact; + /** + * 商户联系电话 + */ + @ExcelProperty(value = "商户联系电话") + @Size(max = 50, message = "商户联系电话不能大于50个字符") + private String storePhone; + /** + * 商户地址 + */ + @ExcelProperty(value = "商户地址") + @Size(max = 300, message = "商户地址不能大于300个字符") + private String storeAddress; + /** + * 商户特殊编号 + */ + @ExcelProperty(value = "商户特殊编号") + @Size(max = 300, message = "商户地址不能大于300个字符") + private String specialNum; + /** + * 门店名称 + */ + @ExcelProperty(value = "门店名称") + @Size(max = 128, message = "门店名称不能大于128个字符") + private String shopName; + /** + * 现有其他收单产品 + */ + @ExcelProperty(value = "现有其他收单产品") + @Size(max = 50, message = "现有其他收单产品不能大于50个字符") + private String products; + /** + * 商户提示工具 + */ + @ExcelProperty(value = "商户提示工具") + @Size(max = 50, message = "商户提示工具不能大于50个字符") + private String tipTool; + /** + * 商户类型 + */ + @DictFormat(dictType = "store_type", rewrite = true) + @ExcelProperty(value = "商户类型") + private Integer storeType; + /** + * 巡检频次 + */ + @DictFormat(dictType = "ins_fre", rewrite = true) + @Range(min = 1, max = 5, message = "巡检频次非法") + @ExcelProperty(value = "巡检频次") + private Integer insFre; + /** + * 终端sn号 + */ + @ExcelProperty(value = "终端sn号") + @Size(max = 100, message = "终端sn号不能大于100个字符") + private String terminalSn; + /** + * 终端编号 + */ + @ExcelProperty(value = "终端编号") + @Size(max = 30, message = "终端编号不能大于30个字符") + private String terminalNo; + /** + * 终端版本号 + */ + @ExcelProperty(value = "终端版本号") + @Size(max = 64, message = "终端版本号不能大于64个字符") + private String terminalVersion; + /** + * 终端地址 + */ + @ExcelProperty(value = "终端地址") + @Size(max = 300, message = "终端地址不能大于300个字符") + private String terminalAddress; + /** + * 终端来源 + */ + @DictFormat(dictType = "terminal_source", rewrite = true) + @Range(min = 1, max = 3, message = "终端来源非法") + @ExcelProperty(value = "终端来源") + private Integer terminalSource; + /** + * 终端类型 + */ + @DictFormat(dictType = "terminal_type", rewrite = true) + @Range(min = 1, max = 9, message = "终端类型非法") + @ExcelProperty(value = "终端类型") + private Integer terminalType; + /** + * 终端型号 + */ + @ExcelProperty(value = "终端型号") + @Size(max = 64, message = "终端型号不能大于64个字符") + private String terminalModel; + /** + * 建档日期 + */ + @ExcelProperty(value = "建档日期") + @Past(message = "必须是过去的日期") + @DateTimeFormat(DatePattern.CHINESE_DATE_PATTERN) + private LocalDate registerTime; + /** + * 操作员账号 + */ + @ExcelProperty(value = "pos编号") + @Size(max = 50, message = "操作员编号不能大于50个字符") + private String userName; + /** + * 客户经理 + */ + @ExcelProperty(value = "客户经理") + @Size(max = 30, message = "客户经理不能大于30个字符") + private String accountManager; + + /** + * 经理电话 + */ + @ExcelProperty(value = "经理电话") + @Size(max = 30, message = "经理电话不能大于30个字符") + private String accountPhone; + + /** + * 注册地址 + */ + @ExcelProperty(value = "注册地址") + @Size(max = 128, message = "注册地址不能大于128个字符") + private String registerAddress; + /** + * 法人/负责人 + */ + @ExcelProperty(value = "法人/负责人") + @Size(max = 64, message = "法人/负责人不能大于64个字符") + private String legalName; + + /** + * 任务名称 + */ + @ExcelProperty(value = "任务名称") + @NotEmpty(message = "任务名称不能为空") + @Size(max = 64, message = "任务名称不能大于64个字符") + private String taskName; + +} diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/po/StoreImport.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/po/StoreImport.java new file mode 100644 index 0000000..5eff77f --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/po/StoreImport.java @@ -0,0 +1,21 @@ +package com.chushang.inspection.terminal.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.chushang.common.mybatis.base.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * 商户导入临时表 + * @auther: zhao + * @date: 2024/7/3 9:48 + */ +@Data +@EqualsAndHashCode(callSuper=true) +@AllArgsConstructor +@NoArgsConstructor +@TableName(value = "st_store_import") +public class StoreImport extends BaseEntity { +} diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/query/TerminalQuery.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/query/TerminalQuery.java index de9ac30..f082d16 100644 --- a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/query/TerminalQuery.java +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/terminal/query/TerminalQuery.java @@ -22,7 +22,6 @@ public class TerminalQuery extends CommonParam { /** * 任务id */ - @NotNull(message = "任务id不能为空") private Long taskId; /** diff --git a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/po/WrkInfoStoreRecord.java b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/po/WrkInfoStoreRecord.java index 587e261..967a78d 100644 --- a/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/po/WrkInfoStoreRecord.java +++ b/chushang-modules/chushang-module-inspection/inspection-feign/src/main/java/com/chushang/inspection/work/po/WrkInfoStoreRecord.java @@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.chushang.common.mybatis.base.BaseEntity; -import java.time.LocalDateTime; -import java.util.Date; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; @@ -141,8 +139,8 @@ public class WrkInfoStoreRecord extends BaseEntity { /** * 本次巡检位置信息(根据经纬度) */ - @TableField(value = "work_adderss") - private String workAdderss; + @TableField(value = "work_address") + private String workAddress; /** * 偏差(直线距离 米) diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/PollTaskController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/PollTaskController.java index 259f652..3c61ebd 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/PollTaskController.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/PollTaskController.java @@ -152,11 +152,10 @@ public class PollTaskController { return AjaxResult.success(); } - // todo 下载导入模板 @SysLog(value = "导入模板", businessType = BusinessType.DOWNLOAD) @PostMapping("/down/template") // @RequiresPermissions("task:down:template") - public AjaxResult downTemplate(@RequestParam(defaultValue = "111") String templateAlias, + public AjaxResult downTemplate(@RequestParam(defaultValue = "task_template") String templateAlias, @RequestParam(defaultValue = "") Long taskId) { return AjaxResult.success(tbTemplateService.getByAlias(templateAlias, taskId)); diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/TemplateController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/TemplateController.java index da66105..670d74c 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/TemplateController.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/controller/TemplateController.java @@ -28,7 +28,7 @@ public class TemplateController { * 模板列表页面 */ @GetMapping(value = "/page") - @RequiresPermissions(value = "ins:template:page") +// @RequiresPermissions(value = "ins:template:page") public AjaxResult pageList(Template template){ return AjaxResult.success(tbTemplateService.pageList(template)); } @@ -37,7 +37,7 @@ public class TemplateController { */ @SysLog(value = "模板", businessType = BusinessType.INSERT) @PostMapping(value = "/save") - @RequiresPermissions(value = "ins:template:save") +// @RequiresPermissions(value = "ins:template:save") public AjaxResult save(@RequestBody@Validated(Create.class) Template template){ return AjaxResult.success(tbTemplateService.saveTemplate(template)); } @@ -46,7 +46,7 @@ public class TemplateController { */ @SysLog(value = "模板", businessType = BusinessType.UPDATE) @PostMapping(value = "/update") - @RequiresPermissions(value = "ins:template:update") +// @RequiresPermissions(value = "ins:template:update") public AjaxResult update(@RequestBody@Validated(Create.class) Template template){ return AjaxResult.success(tbTemplateService.updateTemplate(template)); } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/InspectionDataService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/InspectionDataService.java index b8a634b..9cf713a 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/InspectionDataService.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/InspectionDataService.java @@ -2,6 +2,7 @@ package com.chushang.inspection.project.service; import com.baomidou.mybatisplus.extension.service.IService; import com.chushang.inspection.project.po.InspectionData; +import com.chushang.inspection.work.dto.WrkInfoDTO; import com.chushang.inspection.work.vo.InspectionConfigVO; import java.util.List; @@ -17,4 +18,10 @@ public interface InspectionDataService extends IService{ List listInspections(Long wrkId); List listInspections(Set wrkIds); + + /** + * 提交巡检单信息 + * @param info 巡检单信息 + */ + void submit(WrkInfoDTO info); } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/impl/InspectionDataServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/impl/InspectionDataServiceImpl.java index 10eae2d..6302bb8 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/impl/InspectionDataServiceImpl.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/project/service/impl/InspectionDataServiceImpl.java @@ -2,6 +2,7 @@ package com.chushang.inspection.project.service.impl; import com.chushang.common.mybatis.page.CommonParam; import com.chushang.inspection.project.service.InspectionDataService; +import com.chushang.inspection.work.dto.WrkInfoDTO; import com.chushang.inspection.work.vo.InspectionConfigVO; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -34,4 +35,13 @@ public class InspectionDataServiceImpl extends ServiceImpl tasks = jsonObject.getList("data", TaskExcelDTO.class); + JSONArray data = jsonObject.getJSONArray("data"); + if (CollectionUtil.isEmpty(data)) return Result.failed("内容为空"); + List tasks = data.toList(TaskExcelDTO.class); // 数据集合 // 父类任务ID Long parentId = jsonObject.getLong("parentId"); diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/controller/StoreController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/controller/StoreController.java index 79ac878..9545ef1 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/controller/StoreController.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/controller/StoreController.java @@ -95,7 +95,7 @@ public class StoreController { @SysLog(value = "导入模板", businessType = BusinessType.DOWNLOAD) @PostMapping("/down/template") // @RequiresPermissions("store:down:template") - public AjaxResult downTemplate(@RequestParam(defaultValue = "") String templateAlias, + public AjaxResult downTemplate(@RequestParam(defaultValue = "store_template") String templateAlias, @RequestParam(defaultValue = "") Long taskId) { return AjaxResult.success(tbTemplateService.getByAlias(templateAlias, taskId)); diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/controller/StoreImportController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/controller/StoreImportController.java new file mode 100644 index 0000000..c7aa2ad --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/controller/StoreImportController.java @@ -0,0 +1,25 @@ +package com.chushang.inspection.terminal.controller; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @auther: zhao + * @date: 2024/7/3 9:56 + */ +@RestController +@RequestMapping(value = "/store/import") +public class StoreImportController { + /** + * todo + * 需要 以下接口 + * 1. 导入列表页查询 + * 2. 导出修改 + * 3. 导入删除 + * 4. 导入预读 + * 5. 导入入库 + * 6. store_import 转 store,template,template_ins 表, 转一条数据之后, 就需要同步清除, 避免数据重复 + * 7. 清除当前数据 + */ + +} diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/StoreImportMapper.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/StoreImportMapper.java new file mode 100644 index 0000000..1da9c45 --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/StoreImportMapper.java @@ -0,0 +1,11 @@ +package com.chushang.inspection.terminal.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chushang.inspection.terminal.po.StoreImport; + +/** + * @auther: zhao + * @date: 2024/7/3 9:52 + */ +public interface StoreImportMapper extends BaseMapper { +} diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/TerminalInsMapper.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/TerminalInsMapper.java new file mode 100644 index 0000000..9c02fc8 --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/mapper/TerminalInsMapper.java @@ -0,0 +1,11 @@ +package com.chushang.inspection.terminal.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.chushang.inspection.terminal.po.TerminalIns; + +/** + * @auther: zhao + * @date: 2024/7/2 18:02 + */ +public interface TerminalInsMapper extends BaseMapper { +} diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/StoreImportService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/StoreImportService.java new file mode 100644 index 0000000..b04c75c --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/StoreImportService.java @@ -0,0 +1,11 @@ +package com.chushang.inspection.terminal.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chushang.inspection.terminal.po.StoreImport; + +/** + * @auther: zhao + * @date: 2024/7/3 9:55 + */ +public interface StoreImportService extends IService { +} diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/TerminalInsService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/TerminalInsService.java new file mode 100644 index 0000000..f21ce2f --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/TerminalInsService.java @@ -0,0 +1,11 @@ +package com.chushang.inspection.terminal.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.chushang.inspection.terminal.po.TerminalIns; + +/** + * @auther: zhao + * @date: 2024/7/2 18:03 + */ +public interface TerminalInsService extends IService { +} diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/StoreImportServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/StoreImportServiceImpl.java new file mode 100644 index 0000000..885d9f7 --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/StoreImportServiceImpl.java @@ -0,0 +1,17 @@ +package com.chushang.inspection.terminal.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chushang.inspection.terminal.mapper.StoreImportMapper; +import com.chushang.inspection.terminal.po.StoreImport; +import com.chushang.inspection.terminal.service.StoreImportService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @auther: zhao + * @date: 2024/7/3 9:56 + */ +@Slf4j +@Service +public class StoreImportServiceImpl extends ServiceImpl implements StoreImportService { +} diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/TerminalInsServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/TerminalInsServiceImpl.java new file mode 100644 index 0000000..ac2ee8d --- /dev/null +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/terminal/service/impl/TerminalInsServiceImpl.java @@ -0,0 +1,17 @@ +package com.chushang.inspection.terminal.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.chushang.inspection.terminal.mapper.TerminalInsMapper; +import com.chushang.inspection.terminal.po.TerminalIns; +import com.chushang.inspection.terminal.service.TerminalInsService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +/** + * @auther: zhao + * @date: 2024/7/2 18:03 + */ +@Slf4j +@Service +public class TerminalInsServiceImpl extends ServiceImpl implements TerminalInsService { +} diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java index 23e416f..8ebb22d 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/controller/WrkInfoController.java @@ -108,6 +108,15 @@ public class WrkInfoController { return AjaxResult.success(wrkInfoService.queryArchivePage(query)); } + @SysLog(value = "工单信息", businessType = BusinessType.DOWNLOAD) + @GetMapping("/archive/export") + @RequiresPermissions("wrk:archive:export") + public AjaxResult downInsTemplate(@Validated ReviewedQuery query){ + Integer reviewMethod = TaskConfigUtils.reviewMethod(query.getTaskId()); + query.setStates(reviewMethod == 3 ? Lists.newArrayList(4) : Lists.newArrayList(3)); + return AjaxResult.success(wrkInfoService.downInsTemplate(query)); + } + /** * 查询工单详情 */ @@ -198,13 +207,13 @@ public class WrkInfoController { } /** - * 提交 + * 提交 工单 */ @PostMapping("/submit") @RequiresPermissions("wrk:submit") @SysLog(value = "工单提交", businessType = BusinessType.INSERT) public AjaxResult submit(@Validated @RequestBody WrkInfoDTO info) { -// wrkInfoService.submit(info); + wrkInfoService.submit(info); return AjaxResult.success(); } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java index ca35d89..80ed795 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/WrkInfoService.java @@ -1,6 +1,7 @@ package com.chushang.inspection.work.service; import com.chushang.common.mybatis.utils.PageResult; +import com.chushang.inspection.work.dto.WrkInfoDTO; import com.chushang.inspection.work.po.WrkInfo; import com.baomidou.mybatisplus.extension.service.IService; import com.chushang.inspection.work.query.DispatchQuery; @@ -28,5 +29,7 @@ public interface WrkInfoService extends IService { List dispatch(DispatchQuery query, int i); - Long downInspectionTemplate(ReviewedQuery query); + Long downInsTemplate(ReviewedQuery query); + + void submit(WrkInfoDTO info); } diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java index 2a42a8f..6c0cd48 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/java/com/chushang/inspection/work/service/impl/WrkInfoServiceImpl.java @@ -1,10 +1,13 @@ package com.chushang.inspection.work.service.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.collection.ListUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson2.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -18,16 +21,19 @@ import com.chushang.common.mybatis.enums.Operator; import com.chushang.common.mybatis.page.CommonParam; import com.chushang.common.mybatis.utils.PageResult; import com.chushang.common.mybatis.utils.WrapperUtils; -import com.chushang.datascope.annotation.DataScope; import com.chushang.inspection.ins.GeneratedInsFactory; import com.chushang.inspection.project.service.InspectionDataService; import com.chushang.inspection.terminal.po.FiveStore; +import com.chushang.inspection.terminal.po.Store; +import com.chushang.inspection.terminal.po.Terminal; import com.chushang.inspection.terminal.service.FiveStoreService; +import com.chushang.inspection.terminal.service.StoreService; import com.chushang.inspection.terminal.service.TerminalService; import com.chushang.inspection.terminal.vo.FiveStoreVO; import com.chushang.inspection.utils.StreamUtils; import com.chushang.inspection.utils.TaskConfigUtils; import com.chushang.inspection.work.dto.DispatchDTO; +import com.chushang.inspection.work.dto.WrkInfoDTO; import com.chushang.inspection.work.po.*; import com.chushang.inspection.work.query.DispatchQuery; import com.chushang.inspection.work.query.ReviewedQuery; @@ -51,12 +57,10 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.Map; import java.util.stream.Collectors; /** @@ -79,6 +83,8 @@ public class WrkInfoServiceImpl extends ServiceImpl impl @Resource FiveStoreService fiveStoreService; @Resource + StoreService storeService; + @Resource TerminalService terminalService; @Resource RemoteTaskService remoteTaskService; @@ -179,8 +185,7 @@ public class WrkInfoServiceImpl extends ServiceImpl impl } @Override - @DataScope(deptAlias = "i") - public Long downInspectionTemplate(ReviewedQuery query) { + public Long downInsTemplate(ReviewedQuery query) { // 先查询是否存在对应的记录 WrapperUtils.buildSql(query); Page page = new Page<>(1, 1); @@ -206,6 +211,115 @@ public class WrkInfoServiceImpl extends ServiceImpl impl throw new ResultException("创建后台任务异常"); } + /** + * 提交工单 + * @param info 工单, 商户信息 + */ + @Override + public void submit(WrkInfoDTO info) { + // 获取 任务的审核方式 1 无审核, 2 初审, 3 复审 + Integer reviewMethod = TaskConfigUtils.reviewMethod(info.getTaskId()); +// // 获取工单信息 +// WrkInfo wrkInfo = getById(info.getWrkId()); + // 工单, 商户, 终端信息 + WrkInfoDetailsVO infoDetail = baseMapper.getWrkInfoDetails(info.getWrkId()); + // 工单 + WrkInfoVO wrkInfo = infoDetail.getWrkInfo(); + // 终端 + WrkInfoTerminalVO infoTerminal = infoDetail.getInfoTerminal(); + // 商户 + WrkInfoStoreVO infoStore = infoDetail.getInfoStore(); + // 暂存 --> 工单信息 + WrkInfo tempStorageWrkInfo = BeanUtil.copyProperties(info, WrkInfo.class); + // 暂存 商户信息 + WrkInfoStoreRecord tempStorageStore = BeanUtil.copyProperties(info, WrkInfoStoreRecord.class); + // 暂存 终端信息 + WrkInfoTerminalRecord tempStorageTerminalRecord = BeanUtil.copyProperties(info, WrkInfoTerminalRecord.class); + // 工单状态比较 -- 7应该是暂存 + if (info.getWrkStatus() == 7) { + // geo + tempStorageStore.setWorkLocation(info.getGeographicLocation()); + tempStorageStore.setWorkAddress(info.getLocationAddress()); + tempStorageStore.setWrkId(wrkInfo.getWrkId()); + tempStorageTerminalRecord.setWrkId(wrkInfo.getWrkId()); + tempStorageWrkInfo.setWrkId(wrkInfo.getWrkId()); + // 修改 工单信息 + updateById(tempStorageWrkInfo); + // 修改 商户信息 + wrkInfoStoreRecordService.updateById(tempStorageStore); + // 修改 终端信息 + wrkInfoTerminalRecordService.updateById(tempStorageTerminalRecord); + // 有巡检单并且巡检单不为空时, 去提交巡检单信息 + if (TaskConfigUtils.isisInspection(info.getTaskId()) && CollUtil.isNotEmpty(info.getInspections())) { + inspectionDataService.submit(info); + } + return; + } + wrkInfo.setWrkStatus(info.getWrkStatus()); + LocalDateTime now = LocalDateTime.now(); + // 无需审核, 此处改变下 终端以及对应的商户信息 + if (reviewMethod == 1) { +// // 1. 修改工单 +// Assert.notNull(wrkInfo, "请确认此工单是否存在"); +// Store store = BeanUtil.copyProperties(info, Store.class); +// store.setStoreId(infoStore.getStoreId()); +// // 更新商户 信息, 同时 也需要更新 +// Assert.isTrue(storeService.updateById(store), "更新商户失败"); +// +// Terminal terminal = BeanUtil.copyProperties(info, Terminal.class); +// terminal.setOccupy(0); +// terminal.setTerminalId(infoTerminal.getTerminalId()); +// terminal.setInspectionTime(now); +// terminal.setTerminalStatus(1); +// terminal.setServiceResult(info.getServiceResult()); +// Integer timesPass = terminalService.getById(terminalId).getTimesPass(); +// terminal.setTimesPass(timesPass == null ? 1 : timesPass + 1); +// getMerState(wrkInfo, terminal); +// // 更新终端信息? 为啥要更新终端 +// Assert.isTrue(terminalService.updateById(terminal), "解除终端占用失败"); + } else if (reviewMethod == 2) { +// Assert.isTrue(wrkInfo.getState().equals(1) || wrkInfo.getState().equals(5), +// "【{}】此状态无法提交,指定的审核方式为初审,只有已分配和初审拒绝可以提交", +// DictUtils.getWrkStatusLabel(wrkInfo.getState())); +// +// wrkInfo.setState(2); +// +// BeanUtil.copyProperties(info, wrkInfo, "geographicLocation", "locationAddress", "state"); + + } else { +// Assert.isFalse(ListUtil.toList(2, 3, 4).contains(wrkInfo.getState()), +// "【{}】此状态无法提交,指定的审核方式为复审,只有已分配,初审拒绝或复审拒绝可以提交", +// DictUtils.getWrkStatusLabel(wrkInfo.getState())); +// // 审核(处,复)拒绝 都需要初审 +// if (ListUtil.toList(1, 5, 6).contains(wrkInfo.getState())) { +// wrkInfo.setState(2); +// } else { +// wrkInfo.setState(3); +// } +// +// BeanUtil.copyProperties(info, wrkInfo, "geographic_location", "location_address", "state"); + } + +// wrkInfo.setDisposeTime(now); +// wrkInfo.setWorkLocation(info.getGeographicLocation()); +// wrkInfo.setWorkAdderss(info.getLocationAddress()); +// +// Long deviation = StrUtil.isNotEmpty(wrkInfo.getGeographicLocation()) ? distance(wrkInfo.getGeographicLocation(), wrkInfo.getWorkLocation()) : null; +// +// wrkInfo.setDeviation(deviation); +// +//// Assert.isTrue(mapper.update(wrkInfo) == 1, "提交失败"); +// // 修改 工单信息 +// updateById(tempStorageWrkInfo); +// // 修改 商户信息 +// wrkInfoStoreRecordService.updateById(tempStorageStore); +// // 修改 终端信息 +// wrkInfoTerminalRecordService.updateById(tempStorageTerminalRecord); +// if (TaskConfigUtils.isisInspection(info.getTaskId()) && CollUtil.isNotEmpty(info.getInspections())) { +// dataService.submit(info); +// } + } + /** * 此处调用后台执行 -- 下载word 工单 */ @@ -255,10 +369,6 @@ public class WrkInfoServiceImpl extends ServiceImpl impl return wrkInfo; } - - - - private void saveData(List dispatch,DispatchQuery query,Integer method){ // (0 业务员领取 1 只能派给负责项目的业务员 2 只能派给商户对应的客户经理 ) if(method.equals(0)){ diff --git a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml index 2638f84..15b4b3b 100644 --- a/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml +++ b/chushang-modules/chushang-module-inspection/inspection-service/src/main/resources/mapper/TerminalMapper.xml @@ -21,22 +21,6 @@ - - - - - - - - - - - - - - - - @@ -63,22 +47,6 @@ occupy, terminal_status, remark, - management_code, - geographic_location, - geographic_address, - work_location, - work_adderss, - deviation, - storage_time, - delivery_time, - reason_for_shipment, - operator_id, - precode_encoding, - is_enter, - service_result, - times_pass, - inspection_status, - inspection_time, version, del_state, create_by,