| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.InspectUnaccepted; |
| | | import com.yuanchu.mom.pojo.Opinion; |
| | | import com.yuanchu.mom.mapper.OpinionMapper; |
| | | import com.yuanchu.mom.pojo.dto.UpdateInspectUnacceptedDto; |
| | | import com.yuanchu.mom.service.OpinionService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.utils.MyUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class OpinionServiceImpl extends ServiceImpl<OpinionMapper, Opinion> implements OpinionService { |
| | | |
| | | @Resource |
| | | private OpinionMapper opinionMapper; |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> selectOpinionPage(Page<Object> page, String productName, String specificationsModels) { |
| | | MyUtil.PrintLog(page +"=======" + productName + "===" + specificationsModels); |
| | | return null; |
| | | public List<UpdateInspectUnacceptedDto> clickEditingTriggerQuery(Integer rawUnacceptedId) { |
| | | List<UpdateInspectUnacceptedDto> mapList = opinionMapper.clickEditingTriggerQuery(rawUnacceptedId); |
| | | if (mapList.size() == 0) { |
| | | List<Opinion> list = new ArrayList<>(); |
| | | for (int i = 0; i <= 3; i++) { |
| | | Opinion opinion = new Opinion() |
| | | .setType(i) |
| | | .setRawUnacceptedId(rawUnacceptedId); |
| | | list.add(opinion); |
| | | } |
| | | opinionMapper.insertBatchSomeColumn(list); |
| | | mapList = opinionMapper.clickEditingTriggerQuery(rawUnacceptedId); |
| | | } |
| | | return mapList; |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateOpinion(String id, List<?> opinion) { |
| | | List<Opinion> list = new ArrayList<>(); |
| | | opinion.forEach(i -> { |
| | | try { |
| | | Opinion unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(i), Opinion.class); |
| | | unmarshal.setUserId(Integer.valueOf(id)); |
| | | unmarshal.setFillDate(new Date()); |
| | | list.add(unmarshal); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | }); |
| | | return opinionMapper.updateOpinion(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> viewEditorialComments(Integer rawUnacceptedId) { |
| | | return opinionMapper.viewEditorialComments(rawUnacceptedId); |
| | | } |
| | | } |