|
|
@ -26,8 +26,27 @@ |
|
|
|
package com.yxt.anrui.scm.biz.scmvehpatrolinspectionreport; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspectionsheet.AppLiableListDto; |
|
|
|
import com.yxt.anrui.scm.api.scmvehiclepatrolinspectionsheet.AppPatrolinspectionDto; |
|
|
|
import com.yxt.anrui.scm.api.scmvehinventorymonth.AppVinAndRemarksVo; |
|
|
|
import com.yxt.anrui.scm.api.scmvehinventoryreport.AppReportDto; |
|
|
|
import com.yxt.anrui.scm.api.scmvehinventoryreport.RecipientListDto; |
|
|
|
import com.yxt.anrui.scm.biz.scmvehiclepatrolinspection.ScmVehiclePatrolinspectionService; |
|
|
|
import com.yxt.anrui.scm.biz.scmvehiclepatrolinspectionsheet.ScmVehiclePatrolinspectionsheetService; |
|
|
|
import com.yxt.anrui.scm.biz.scmvehinventorymonth.ScmVehInventorymonthService; |
|
|
|
import com.yxt.common.base.utils.JPushServer; |
|
|
|
import com.yxt.messagecenter.api.message.AppMessageDto; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
import com.yxt.messagecenter.api.message.MsgTargetUriEnum; |
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageListDto; |
|
|
|
import com.yxt.messagecenter.api.messagelist.MessageListFeign; |
|
|
|
import com.yxt.messagecenter.api.messagetype.MessageTypeFeign; |
|
|
|
import com.yxt.messagecenter.api.messagetype.MessageTypeVo; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -41,9 +60,14 @@ import com.yxt.anrui.scm.api.scmvehpatrolinspectionreport.ScmVehPatrolinspection |
|
|
|
import com.yxt.anrui.scm.api.scmvehpatrolinspectionreport.ScmVehPatrolinspectionreportDto; |
|
|
|
import com.yxt.anrui.scm.api.scmvehpatrolinspectionreport.ScmVehPatrolinspectionreportFeign; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.Future; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: aaa(aaa) <br/> |
|
|
@ -60,51 +84,117 @@ import java.util.List; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class ScmVehPatrolinspectionreportService extends MybatisBaseService<ScmVehPatrolinspectionreportMapper, ScmVehPatrolinspectionreport> { |
|
|
|
private QueryWrapper<ScmVehPatrolinspectionreport> createQueryWrapper(ScmVehPatrolinspectionreportQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<ScmVehPatrolinspectionreport> qw = new QueryWrapper<>(); |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<ScmVehPatrolinspectionreportVo> listPageVo(PagerQuery<ScmVehPatrolinspectionreportQuery> pq) { |
|
|
|
ScmVehPatrolinspectionreportQuery query = pq.getParams(); |
|
|
|
QueryWrapper<ScmVehPatrolinspectionreport> qw = createQueryWrapper(query); |
|
|
|
IPage<ScmVehPatrolinspectionreport> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<ScmVehPatrolinspectionreportVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<ScmVehPatrolinspectionreportVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(ScmVehPatrolinspectionreportDto dto){ |
|
|
|
|
|
|
|
@Autowired |
|
|
|
ScmVehiclePatrolinspectionService scmVehiclePatrolinspectionService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
ScmVehiclePatrolinspectionsheetService scmVehiclePatrolinspectionsheetService; |
|
|
|
/** |
|
|
|
* 消息类型:0002手机端 |
|
|
|
*/ |
|
|
|
public static final String IDENTIFIER = "0002"; |
|
|
|
@Autowired |
|
|
|
ScmVehInventorymonthService scmVehInventorymonthService; |
|
|
|
@Autowired |
|
|
|
private MessageFeign messageFeign; |
|
|
|
@Autowired |
|
|
|
private MessageTypeFeign messageTypeFeign; |
|
|
|
@Autowired |
|
|
|
private MessageListFeign messageListFeign; |
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
|
|
|
|
private QueryWrapper<ScmVehPatrolinspectionreport> createQueryWrapper(ScmVehPatrolinspectionreportQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
|
|
|
QueryWrapper<ScmVehPatrolinspectionreport> qw = new QueryWrapper<>(); |
|
|
|
return qw; |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<ScmVehPatrolinspectionreportVo> listPageVo(PagerQuery<ScmVehPatrolinspectionreportQuery> pq) { |
|
|
|
ScmVehPatrolinspectionreportQuery query = pq.getParams(); |
|
|
|
QueryWrapper<ScmVehPatrolinspectionreport> qw = createQueryWrapper(query); |
|
|
|
IPage<ScmVehPatrolinspectionreport> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<ScmVehPatrolinspectionreportVo> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<ScmVehPatrolinspectionreportVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(ScmVehPatrolinspectionreportDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
this.insertByDto(dto); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
} |
|
|
|
|
|
|
|
public void insertByDto(ScmVehPatrolinspectionreportDto dto){ |
|
|
|
ScmVehPatrolinspectionreport entity = new ScmVehPatrolinspectionreport(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public void updateByDto(ScmVehPatrolinspectionreportDto dto){ |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
} |
|
|
|
|
|
|
|
public void insertByDto(ScmVehPatrolinspectionreportDto dto) { |
|
|
|
ScmVehPatrolinspectionreport entity = new ScmVehPatrolinspectionreport(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public void updateByDto(ScmVehPatrolinspectionreportDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
ScmVehPatrolinspectionreport entity = fetchBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public ScmVehPatrolinspectionreportDetailsVo fetchDetailsVoBySid(String sid){ |
|
|
|
ScmVehPatrolinspectionreport entity = fetchBySid(sid); |
|
|
|
ScmVehPatrolinspectionreportDetailsVo vo = new ScmVehPatrolinspectionreportDetailsVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
} |
|
|
|
ScmVehPatrolinspectionreport entity = fetchBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public ScmVehPatrolinspectionreportDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
|
ScmVehPatrolinspectionreport entity = fetchBySid(sid); |
|
|
|
ScmVehPatrolinspectionreportDetailsVo vo = new ScmVehPatrolinspectionreportDetailsVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean sendReport(ScmVehPatrolinspectionreportDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(dto.getUserSid()).getData(); |
|
|
|
ScmVehPatrolinspectionreport scmVehPatrolinspectionreport = new ScmVehPatrolinspectionreport(); |
|
|
|
BeanUtil.copyProperties(dto, scmVehPatrolinspectionreport); |
|
|
|
String StateKey1 = "001"; |
|
|
|
String StateKey2 = "002"; |
|
|
|
List<AppVinAndRemarksVo> questions1 = scmVehiclePatrolinspectionService.getMonthRemarksByMainSid(dto.getMainSid(), StateKey1); |
|
|
|
List<AppVinAndRemarksVo> questions2 = scmVehiclePatrolinspectionService.getMonthRemarksByMainSid(dto.getMainSid(), StateKey2); |
|
|
|
|
|
|
|
StringBuilder question = new StringBuilder(); |
|
|
|
|
|
|
|
for (AppVinAndRemarksVo remark : questions1) { |
|
|
|
// 问题未解决
|
|
|
|
question.append(remark.getVinNo()); |
|
|
|
question.append(":"); |
|
|
|
question.append(remark.getRemarks()); |
|
|
|
question.append("(问题已反馈)"); |
|
|
|
question.append("\n"); |
|
|
|
} |
|
|
|
for (AppVinAndRemarksVo remark : questions2) { |
|
|
|
// 问题已解决
|
|
|
|
question.append(remark.getVinNo()); |
|
|
|
question.append(":"); |
|
|
|
question.append(remark.getRemarks()); |
|
|
|
question.append("(问题已解决)"); |
|
|
|
question.append("\n"); |
|
|
|
} |
|
|
|
save(scmVehPatrolinspectionreport); |
|
|
|
scmVehiclePatrolinspectionService.updateState(dto.getMainSid()); |
|
|
|
List<String> receiveIdList = new ArrayList<>(); |
|
|
|
List<AppLiableListDto> list = dto.getList(); |
|
|
|
for (AppLiableListDto appLiableListDto : list) { |
|
|
|
SysUserVo data = sysUserFeign.fetchBySid(appLiableListDto.getLiableSid()).getData(); |
|
|
|
receiveIdList.add(String.valueOf(data.getId())); |
|
|
|
} |
|
|
|
AppPatrolinspectionDto appPatrolinspectionDto = new AppPatrolinspectionDto(); |
|
|
|
appPatrolinspectionDto.setMsgContent(sysUserVo.getName()); |
|
|
|
appPatrolinspectionDto.setList(dto.getList()); |
|
|
|
appPatrolinspectionDto.setMainSid(dto.getMainSid()); |
|
|
|
appPatrolinspectionDto.setReceiveIdList(receiveIdList); |
|
|
|
scmVehiclePatrolinspectionsheetService.sendMessage(appPatrolinspectionDto); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |