| | |
| | | import com.whyc.mapper.ProductHistoryMapper; |
| | | import com.whyc.pojo.BOMFeedback; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.pojo.Product; |
| | | import com.whyc.pojo.ProductHistory; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.DateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Resource |
| | | private ProductHistoryMapper phisMapper; |
| | | |
| | | @Autowired |
| | | private ProductService productService; |
| | | |
| | | //统计 |
| | | public Map<String, Integer> getFkStatistic(DocUser user,Map<String, Integer> map) { |
| | | int sendFk=0; |
| | |
| | | * @param feedback |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | public Response confirmFeedback(BOMFeedback feedback) { |
| | | DocUser user = ActionUtil.getUser(); |
| | | int userId = user.getId().intValue(); |
| | |
| | | int count=mapper.update(null,wrapper); |
| | | bl=count>0; |
| | | msg="接收者确认反馈"; |
| | | |
| | | if(confirmStatus == 2){ |
| | | //解锁产品 |
| | | Integer productId = mapper.selectById(id).getProductId(); |
| | | Product product = productService.getById(productId); |
| | | //解锁产品时解锁锁定时的版本号 |
| | | QueryWrapper<BOMFeedback> query = Wrappers.query(); |
| | | query.eq("id",id).last(" limit 1"); |
| | | BOMFeedback feed = mapper.selectOne(query); |
| | | int nowVersion=feed.getNowVersion(); |
| | | if(product!=null){ |
| | | if(nowVersion!=-1){ |
| | | phisService.setpHistoryEnable(product.getParentCode(),product.getCustomCode(),nowVersion,1,"问题反馈后"+ username +"确认不需要修改bom,系统执行产品解锁",DateUtil.YYYY_MM_DD_HH_MM_SS.format(product.getVersionTime())); |
| | | } |
| | | }else{ |
| | | ProductHistory phis = phisService.getById(productId); |
| | | phisService.setpHistoryEnable(phis.getParentCode(),phis.getCustomCode(),phis.getVersion(),1,"问题反馈后"+ username +"确认不需要修改bom,系统执行产品解锁",DateUtil.YYYY_MM_DD_HH_MM_SS.format(phis.getVersionTime())); |
| | | } |
| | | } |
| | | } |
| | | return new Response().set(1,bl,msg); |
| | | } |
| | |
| | | //for (File file : fileList) { |
| | | // file.delete(); |
| | | //} |
| | | |
| | | //查询产品的信息 |
| | | QueryWrapper hisWrapper=new QueryWrapper(); |
| | | hisWrapper.eq("id",feedback.getProductId()); |
| | | hisWrapper.last("limit 1"); |
| | | ProductHistory phis=phisMapper.selectOne(hisWrapper); |
| | | //保存 |
| | | feedback.setCreateTime(date); |
| | | feedback.setConfirmStatus(0); |
| | | feedback.setNowVersion(phis.getVersion()); |
| | | mapper.insert(feedback); |
| | | //发送邮件 |
| | | String receiverIds = feedback.getReceiverIds(); |
| | |
| | | } |
| | | |
| | | String subject = "【Bom问题反馈】-"+senderName; |
| | | String content = feedback.getContent(); |
| | | //邮件内容,添加产品的相关信息 |
| | | Product product = productService.getById(feedback.getProductId()); |
| | | |
| | | String content ="产品料号:"+product.getParentCode() + "\n产品名称:"+product.getParentName() + "\n产品型号:"+product.getParentModel() + "\n版本时间:"+ DateUtil.YYYY_MM_DD_HH_MM_SS.format(product.getVersionTime()) + "\n定制单号:"+product.getCustomCode() + "\n产品反馈内容:"+ feedback.getContent(); |
| | | |
| | | MailDTO mailDTO = new MailDTO(); |
| | | mailDTO.setTitle(subject); |
| | |
| | | mailService.sendMail(mailDTO); |
| | | //mailUtil.sendMailBatch(senderName,receiverMailList,subject,content); |
| | | //反馈时直接根据productid直接锁定 |
| | | //查询产品的信息 |
| | | QueryWrapper hisWrapper=new QueryWrapper(); |
| | | hisWrapper.eq("id",feedback.getProductId()); |
| | | hisWrapper.last("limit 1"); |
| | | ProductHistory phis=phisMapper.selectOne(hisWrapper); |
| | | phisService.setpHistoryEnable(phis.getParentCode(),phis.getCustomCode(),phis.getVersion(),0,feedback.getContent(),ActionUtil.sdfwithALL.format(phis.getVersionTime())); |
| | | return new Response().set(1,true,"反馈完成"); |
| | | } |