中扬CRM客户关系管理系统
#
LSH
2023-11-04 bf2fbd9f3e90dd2ef508c5944ae63491397b42ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.zy.crm.manager.task.handler;
 
import com.core.common.Cools;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.crm.manager.controller.CstmrController;
import com.zy.crm.manager.entity.Cstmr;
import com.zy.crm.manager.mapper.CstmrMapper;
import com.zy.crm.manager.service.CstmrService;
import com.zy.crm.manager.task.AbstractHandler;
import com.zy.crm.manager.task.core.ReturnT;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
 
/**
 * Created by vincent on 2020/7/6
 */
@Slf4j
@Service
public class CstmrCopyHandler extends AbstractHandler<String> {
    @Autowired
    private CstmrService cstmrService;
    @Autowired
    private CstmrController cstmrController;
    @Autowired
    private CstmrMapper cstmrMapper;
 
 
    @Transactional
    public ReturnT<String> start() {
        try {
            Long hostId = 1L;
//            List<Cstmr> cstmrs = cstmrMapper.selectCopyList();
            List<Cstmr> cstmrs = new ArrayList<>();
            for (Cstmr cstmr33 : cstmrs){
                Cstmr cstmr13 = cstmrService.selectByName(hostId,cstmr33.getName());
                if (Cools.isEmpty(cstmr13)){
                    Cstmr cstmr23 = cstmrService.selectById(186);
                    Cstmr cstmr = new Cstmr(cstmr23);
                    cstmr.setName(cstmr33.getName());
                    cstmr.setUuid(cstmrService.getUuid(hostId));
                    cstmrService.insert(cstmr);
                }
            }
 
 
        } catch (Exception e) {
            log.error("fail", e);
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return FAIL.setMsg(e.getMessage());
        }
        return SUCCESS;
    }
 
}