123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- package com.jpsoft.excellent.modules.open;
- import com.github.pagehelper.Page;
- import com.jpsoft.excellent.config.OSSConfig;
- import com.jpsoft.excellent.modules.base.entity.*;
- import com.jpsoft.excellent.modules.base.service.*;
- import com.jpsoft.excellent.modules.common.dto.MessageResult;
- import com.jpsoft.excellent.modules.common.dto.Sort;
- import com.jpsoft.excellent.modules.common.utils.OSSUtil;
- import com.jpsoft.excellent.modules.common.utils.SMSUtil;
- import com.jpsoft.excellent.modules.sys.entity.DataDictionary;
- import com.jpsoft.excellent.modules.sys.entity.SysLog;
- import com.jpsoft.excellent.modules.sys.service.DataDictionaryService;
- import com.jpsoft.excellent.modules.sys.service.SysLogService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import org.apache.commons.lang3.StringUtils;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.transaction.annotation.Transactional;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.bind.annotation.RestController;
- import sun.misc.BASE64Decoder;
- import java.io.ByteArrayInputStream;
- import java.text.SimpleDateFormat;
- import java.util.*;
- @RestController
- @RequestMapping("/open/officeOpinionApi")
- @Api(description = "移动端")
- public class OfficeOpinionApiController {
- private Logger logger = LoggerFactory.getLogger(getClass());
- @Autowired
- private OSSConfig ossConfig;
- @Autowired
- private SysLogService sysLogService;
- @Autowired
- private DataDictionaryService dataDictionaryService;
- @Autowired
- private WorkStationService workStationService;
- @Autowired
- private WorkWindowService workWindowService;
- @Autowired
- private OfficeService officeService;
- @Autowired
- private OfficeOpinionService officeOpinionService;
- @Autowired
- private AreaService areaService;
- @ApiOperation(value="添加反馈信息")
- @PostMapping("add")
- @Transactional(rollbackFor = Exception.class)
- @ApiImplicitParams({
- @ApiImplicitParam(name="connect", value="联系人", required=true, paramType="query"),
- @ApiImplicitParam(name="connectPhone", value="联系电话", required=true, paramType="query"),
- @ApiImplicitParam(name="officeId", value="单位编号", required=true, paramType="query"),
- @ApiImplicitParam(name="isSatisfied", value="是否满意", required=true, paramType="query", dataType="Boolean"),
- @ApiImplicitParam(name="content", value="内容", paramType="query"),
- @ApiImplicitParam(name="appendixs", value="附件", paramType="query"),
- })
- public MessageResult<OfficeOpinion> add(String connect,String connectPhone,String officeId,String isSatisfied,String content,String[] appendixs){
- MessageResult<OfficeOpinion> msgResult = new MessageResult<>();
- try {
- OfficeOpinion officeOpinion = new OfficeOpinion();
- officeOpinion.setId(UUID.randomUUID().toString());
- officeOpinion.setConnect(connect);
- officeOpinion.setConnectPhone(connectPhone);
- officeOpinion.setOfficeId(officeId);
- if("0".equals(isSatisfied)) {
- officeOpinion.setIsSatisfied(false);
- String MessageContent = "【双优督办】干部监督评议有一条投诉,请查收。";
- String UserNumber = "13677200818,13647155484";
- SMSUtil.sendSMS(MessageContent, UserNumber, null);
- }
- else{
- officeOpinion.setIsSatisfied(true);
- }
- officeOpinion.setContent(content);
- officeOpinion.setAppendix(String.join(",",appendixs));
- officeOpinion.setDelFlag(false);
- officeOpinion.setCreateTime(new Date());
- officeOpinion.setOpinionStatus(false);
- officeOpinion.setConfirmStatus(false);
- officeOpinionService.insert(officeOpinion);
- msgResult.setResult(true);
- msgResult.setData(officeOpinion);
- }
- catch(Exception ex){
- logger.error(ex.getMessage(),ex);
- msgResult.setResult(false);
- msgResult.setMessage(ex.getMessage());
- }
- return msgResult;
- }
- @ApiOperation(value="获取单位")
- @PostMapping("officeList")
- @ApiImplicitParams({
- @ApiImplicitParam(name="name", value="单位名", required=true, paramType="query"),
- })
- public MessageResult officeList(String name){
- MessageResult msgResult = new MessageResult<>();
- try {
- Map<String, Object> searchParams = new HashMap<>();
- if (StringUtils.isNotEmpty(name)) {
- searchParams.put("name","%" + name + "%");
- }
- List<Sort> sortList = new ArrayList<>();
- sortList.add(new Sort("name_", "asc"));
- Page<Office> page = officeService.pageSearch(searchParams, 1, 10000, false, sortList);
- msgResult.setResult(true);
- msgResult.setData(page.getResult());
- }
- catch(Exception ex){
- logger.error(ex.getMessage(),ex);
- msgResult.setResult(false);
- msgResult.setMessage(ex.getMessage());
- }
- return msgResult;
- }
- @ApiOperation(value="历史记录")
- @PostMapping("historyList")
- @ApiImplicitParams({
- @ApiImplicitParam(name="phone", value="手机号码", required=true, paramType="query"),
- })
- public MessageResult historyList(String phone){
- MessageResult msgResult = new MessageResult<>();
- try {
- Map<String, Object> searchParams = new HashMap<>();
- if (StringUtils.isNotEmpty(phone)) {
- searchParams.put("connectPhone",phone);
- }
- List<Sort> sortList = new ArrayList<>();
- sortList.add(new Sort("create_time", "desc"));
- Page<OfficeOpinion> page = officeOpinionService.pageSearch(searchParams, 1, 10000, false, sortList);
- msgResult.setResult(true);
- msgResult.setData(page.getResult());
- }
- catch(Exception ex){
- logger.error(ex.getMessage(),ex);
- msgResult.setResult(false);
- msgResult.setMessage(ex.getMessage());
- }
- return msgResult;
- }
- }
|